Can an ossn_get_object_owner_guid function be made?

Georgi Shindarov Posted in Component Development 1 year ago

Hi, I'm trying to make a basic reporting component using the OssnPoke component as a base. I've had some success but I can only report a user or post from when I'm on their user wall.. When I report the post I want to report from the newsfeed my wall in the ossn_notiftcations database I get a value of zero for poster_guid and what happens when I do it from the wall my user is shown the actual user numbers. I think I need to create a function similar to ossn_get_page_owner_guidto retrieve the post owner number. Would any of you be able to help me?
The function can be called ossn_get_object_owner_guid and retrieve the number of user who created a given post.. Is it possible for one of you to do it.. or explain me how to do it..?

Replies
vn Belin da Replied 1 year ago

Retro Bowl is the ideal game for the armchair quarterback to prove their point.

Indonesian Arsalan Shah Replied 1 year ago

You are most welcome and I am glad your issue is resolved

Bulgarian Georgi Shindarov Replied 1 year ago

Thank you so much man.. you are great! ..I am too poor to buy anything from you.. I don't even have a bank account.. but I am extremely grateful to you for the OSSN you have made.. ...What you are doing is great !!!

Indonesian Arsalan Shah Replied 1 year ago

Your hook should look like this

function ossn_wall_post_menu_report($name, $type, $return, $params) {    //notice the 4th parameter not 3rd
        $post = $params['post']; //this contains the post
        $user = ossn_get_page_owner_guid();
        $report = ossn_site_url("action/report/user?user={$post->owner_guid}&post_guid={$post->guid}", true);
                ossn_unregister_menu('report', 'wallpost'); 
                ossn_register_menu_item('wallpost', array(
                        'name'      => 'report',                        
                        'text'      => ossn_print('report'),
                        'href'      => $report,
            ));             
} 

.

Indonesian Arsalan Shah Replied 1 year ago

You should also see https://www.opensource-socialnetwork.org/wiki/view/739/naming-convention-for-components-and-themes Should not start name with Ossn except core components.

Indonesian Arsalan Shah Replied 1 year ago

There is already a paid component https://www.openteknik.com/product/view/1768/reported-contents

However you need to do following to register a notification , see my answer here https://www.opensource-socialnetwork.org/discussion/view/2967/how-to-send-notifications-to-users-using-ossnnotifications-class)?offset=2

here replace :type to your :type example :reportnotification
<?php

function init_function(){
    ossn_add_hook('notification:view', 'notification:type', 'notification_view');
    ossn_add_hook('notification:add', 'notification:type', 'notification_add_config');    
}
function notification_view($hook, $type, $return, $params){
            see the notifcation:view of other components
            return //   
}   
function notification_add_config($hook, $type, $return, $params){
            $params['owner_guid'] = $params['notification_owner']
            ..
            ..
            .. 
            return $params
}

then you can add following to add notifcation

    $notification = new OssnNotifications;
    $notification->add(type, guid of user who will see notification, subject guid which cause this notification....);

However your question regarding

ossngetobjectownerguid and retrieve the number of user who created a given post

If you have a wall post object then by calling $user = ossn_user_by_guid($wall->poster_guid) you can get a user object who created the post.

Bulgarian Georgi Shindarov Replied 1 year ago

enter image description here

Bulgarian Georgi Shindarov Replied 1 year ago

enter image description here