thetechgenius
07-17-2014, 06:38 PM
I added 2 plugins to add a "Send PM" button and a "Add Friend" button to the bottom of the postbit. The only problem is, they are visible to everyone, including users not logged in. The other default buttons are only visible to Logged-In users, so it looks weird to see only the 2 buttons visible.
Here is my code for the "Add Friend" button:
Plugin PHP Code
$postuserinfo = fetch_userinfo($post['userid'], 128);
$isfriend = $postuserinfo['isfriend'];
if (!$isfriend)
{
$template_hook['postbit_controls'] .= '<span class="addfriend"><a href="profile.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=addlist&userlist=friend&u=' . $post['userid'] . '">' . construct_phrase($vbphrase['add_as_friend'], $post['username']) . '<img class="addimg" alt="Add as Friend" src="images/site_icons/add.png"></a><span class="seperator"></span></span>';
}
Here is my code for the "Send PM" button:
Plugin PHP Code
$postuserinfo = fetch_userinfo($post['userid'], 128);
{
$template_hook['postbit_controls'] .= '<span class="sendpm"><a href="private.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=newpm&u=' . $post['userid'] . '">' . construct_phrase($vbphrase['send_pm'], $post['username']) . '<img class="pmimg2" alt="Send PM" src="images/site_icons/pm.png"></a><span class="seperator"></span></span>';
}
What code do I add to these plugins to make them only visible to Registered Users?
The uploaded attachment is a screenshot of the postbit buttons from Guest View.
Here is my code for the "Add Friend" button:
Plugin PHP Code
$postuserinfo = fetch_userinfo($post['userid'], 128);
$isfriend = $postuserinfo['isfriend'];
if (!$isfriend)
{
$template_hook['postbit_controls'] .= '<span class="addfriend"><a href="profile.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=addlist&userlist=friend&u=' . $post['userid'] . '">' . construct_phrase($vbphrase['add_as_friend'], $post['username']) . '<img class="addimg" alt="Add as Friend" src="images/site_icons/add.png"></a><span class="seperator"></span></span>';
}
Here is my code for the "Send PM" button:
Plugin PHP Code
$postuserinfo = fetch_userinfo($post['userid'], 128);
{
$template_hook['postbit_controls'] .= '<span class="sendpm"><a href="private.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=newpm&u=' . $post['userid'] . '">' . construct_phrase($vbphrase['send_pm'], $post['username']) . '<img class="pmimg2" alt="Send PM" src="images/site_icons/pm.png"></a><span class="seperator"></span></span>';
}
What code do I add to these plugins to make them only visible to Registered Users?
The uploaded attachment is a screenshot of the postbit buttons from Guest View.