Notifications for tagged user/friend in Text Area of Wall.

Nik Fury Posted in Component Development 3 years ago

Many Thanks Arsalan for assisting me in tagging friends in wall post. Iam trying to make notifications work for tagged friend in wall post . Heres the link . https://github.com/nikhilvinnakoti/MyTruckerPro/blob/main/MentionNotifications/ossn_com.php. So I am trying to make changes in mention notifications for wall post. Please have a look at the functions at lines 25,88,107,115,136,155. Please tell me whats wrong here. I implemented the same logic u suggested earlier for wall mentions. I think in function present at line 136 I need to make changes. Iam not clear about annotations. Also I need to add a switch case for wall in function present at line 37.

Replies
German Michael Zülsdorff Replied 3 years ago

Nik,
It's just 18 hours ago when I asked you to locate the add function of the OssnNotifications class.
I didn't do that to steal your time, I did it intentionally because the expected parameters are clearly documented there by Arsalan.

And now you ask: Please let me know which parameters to use here. ?!?

Sorry, but if you're not even showing the slightest will and interest to understand things, then please try getting help somewhere else. At least I'm no longer available on this subject.

in Nik Fury Replied 3 years ago

So if its correct. The next step is to add notifcations to ossnnotifications database right? Please let me know which parameters to use here. $notifications->add('mention:post:created', $params['ownerguid'], $params['subject_guid'], $user->guid);

Indonesian Arsalan Shah Replied 3 years ago

He is right you used correct $args['text'].

in Nik Fury Replied 3 years ago

Sorry Arsalan. Earlier he told me that $post is wrong . Also he told me to use text element of args array. So I thought $args['text']. Since he told me to change pregmatchall line, I thought I should replace $post with $args['text']. Please guide me .

Indonesian Arsalan Shah Replied 3 years ago

Sorry Nikhil, no offense here but I begin to think that you are really not sure what you are trying to achieve. Despite we telling you again and again. Z-men already told you what to use.

in Nik Fury Replied 3 years ago

Is it args['text']? enter image description here

German Michael Zülsdorff Replied 3 years ago

Yes, both are be usable. But since the string in description is saved in a JSON encoded format and would need an extra line to decode it first, I would prefer using the much simpler text element.
So please change the preg_match_all line to use that text element of the $args array

in Nik Fury Replied 3 years ago

Yeah I commented it for now. Iam assuming the field(element) as either text or description .Am I correct?enter image description here

German Michael Zülsdorff Replied 3 years ago

That's correct!
So,
1. you now know which parameters this method is actually expecting
2. you now know that this method would add a new record to the ossn_notifications database table, thus passing any wrong parameters would result in a bad/unusable record.
So, before you are really sure about which parameters to be passed, I strongly recommend to temporarely comment out that line in your code like

// $notifications->add('mention:post:created', $params['owner_guid'].........,

Done that? Okay.

Then back to the not working preg_match_all line:
As your debug output at the bottom already shows, this function's second argument has to be a STRING. A string which will be parsed for one or more occurences of @user1, @user2, and so on.
But you're not delivering a string, but $post. And that's NOT a string but an object.
So have look into your debug output of the $args array again, and find the element which contains the string you're interested in.

in Nik Fury Replied 3 years ago

Its OssnNotifications.php right? Theres an add function present in that file

Premium Version

Due to the many requests in the past for additonal features and components we have decided to develope a premium version. Features like Hashtags, Videos, Polls, Events, Stories, Link Preview, etc included in it.

$199 (Life Time)
Learn More

Other Questions