Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Thread: 

Show profile only for my buddy list members

Ads
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#1
Member
Hello
How can I show my profile only to my buddy list members in mybb ?

Best Regards
Heart
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#2
Support Team
Hi, I am still learning PHP but I think I can do it. Let me create a plugin for you and hopefully it will work wish me luck Wink
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#3
Member
Good Luck marcus_avrelius
Heart
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#4
Support Team
Here is a plugin just upload it to MYBB plugin directory which is located in .inc/plugins and activate it from Admin Control Panel.

PHP Code:
<?php

if(!defined('IN_MYBB'))
{
    die();
}

$plugins->add_hook('member_profile_end','profilebuddies');

function 
profilebuddies_info()
{
    return array
    (
        
'name'=>'Buddies Profile Blocker',
        
'description'=>'Block access to profile for everyone except Buddies',
        
'website'=>'http://letsforum.com',
        
'author'=>'Victor Dub and dragonexpert',
        
'version'=>'1',
        
'compatibility'=>'14*,16*',
    );
}

function 
profilebuddies()
{
    global 
$mybb$db;
    
// First get the buddy list of the user who's profile we are viewing.
    
$query $db->simple_select("users""buddylist""uid=" intval($mybb->input['uid']));
    
$member $db->fetch_field($query"buddylist");
    
$buddylist explode(","$member);
    if(
$buddylist// Need to check if this is valid or a warning will occur
    
{
        if(!
in_array($mybb->user['uid'], $buddylist))
        {
            
error_no_permission();
        }
    }
}
?>

Save the file as profilebuddies.php

Had to ask for help because I am good at HTML, CSS and Template conditionals but terrible at PHP. I am still learning PHP.

Thanks to dragonexpert from MYBB.
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#5
Member
Thanks for plugin





User(s) browsing this thread: 1 Guest(s)