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

Perfect!
But before investigating what's wrong with $post,
let's first advance a few lines down to

$notifications->add('mention:post:created', ....

Please locate the class file with the add method

in Nik Fury Replied 3 years ago

Hello Z Man . First parameter is regex search pattern in wall textarea. Second parameter should be content of text area...in my case @nikhil(but this parameter($post) is wrong thats why I need help here). If Iam not mistaken third parameter is basically array of possible matches that are obtained when iterated through second parameter(@nikhil) using regex search pattern(first parameter).

German Michael Zülsdorff Replied 3 years ago

Okay,
please explain what are you trying to achieve with this line?

preg_match_all('/@(\w+)/', $post, $matches);
in Nik Fury Replied 3 years ago

Hello Arsalan . I have added the code in callback function and debugged args. Iam attaching image for reference. Iam able to get content of textarea(i.e @nikhil). Seems I need to modify callback function a little bit. Please have a look at the function.">https://github.com/nikhilvinnakoti/MyTruckerPro/blob/da3231736ee6c4b732283e039987f5a4c0dd6dcc/MentionNotifications/ossn_com.php#L133enter image description here

Indonesian Arsalan Shah Replied 3 years ago

Now you can add following in you callback and debug $args

     $wall = new OssnWall;
     $post = $wall->GetPost($params['guid']);
     $args = ossn_wallpost_to_item($post);

See what exactly the $args contains if it contain anything useful for you tell us

in Nik Fury Replied 3 years ago

Iam extremely sorry Arsalan. I misunderstood it . Heres the screenshot for debugging paramsenter image description here

Indonesian Arsalan Shah Replied 3 years ago

See what ~Z~ Man said, I never told you to debug $params['value'] read his reply again please. Learn how to debug arrays in php. Again we can not help here to improve programming skills. One you find out what exactly $params contain please we can talk that time.

in Nik Fury Replied 3 years ago

Hello Arsalan . Iam sorry. I did what u told me . Firstly u told me to debug $params['value'] right? Iam attaching image for reference. Its empty. enter image description here

Indonesian Arsalan Shah Replied 3 years ago

I am sorry teaching debugging of simple variables and why its not showing anything in error log is outside scope of our forum. I can not help you any further Nikhil. https://stackoverflow.com/a/19487475 I won't look your changes either as you are jumping behind not going step by step.

in Nik Fury Replied 3 years ago

Hello Z-Man and Arsalan . Regarding second point @Arsalan u told me to remove $return = $params(mentionswallcreated why you added $return = $params; its of no use and making problem.)since its causing problem I removed it and modified function . Please have a look at this function . https://github.com/nikhilvinnakoti/MyTruckerPro/blob/14aa9b3f239e9843f5888f3a5fc8a176b55a0583/MentionNotifications/ossn_com.php#L149 .Guess its correct because its not making any sense($return=$params is not making any sense). Regarding firstpoint what should I use to fetch value of textarea(Instead of $params['value'] what should I use). Please help me guys

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