2012-01-05, 07:25 PM
Hello. I want to make links visible to only registered members. How can i do that ? So if you are not registered it should display like "Please register to see links"
Thank you
Thank you
(2012-01-05, 07:25 PM)MonsterMMORPG Wrote: [ -> ]Hello. I want to make links visible to only registered members. How can i do that ? So if you are not registered it should display like "Please register to see links"
Thank you
<if $GLOBALS['mybb']->user['usergroup'] >= 2 then>
some link
elseif
please register
</if>
(2012-01-05, 07:48 PM)ranjani Wrote: [ -> ]see scd code hide plugin
(2012-01-05, 07:39 PM)JimR Wrote: [ -> ](2012-01-05, 07:25 PM)MonsterMMORPG Wrote: [ -> ]Hello. I want to make links visible to only registered members. How can i do that ? So if you are not registered it should display like "Please register to see links"
Thank you
download & install the template conditionals plugin
and some code like
<if $GLOBALS['mybb']->user['usergroup'] >= 2 then> some link elseif please register </if>
It works well but look at this
<?php
if(!defined("IN_MYBB"))
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
$plugins->add_hook("parse_message", "onlyreglinks");
function onlyreglinks_info() {
return array(
"name" => "Registered Members Links",
"description" => "Links for only registered members",
"author" => "your name",
"version" => "1.0.0",
"compatibility" => "16*"
);
}
function onlyreglinks_active() {
}
function onlyreglinks_deactive() {
}
function onlyreglinks($content) {
global $mybb;
if($mybb->user['usergroup'] < 2) {
$content = preg_replace("/<a href=\"(.*?)\" target=\"(.*?)\">(.*?)<\/a>/is","<a href=\"".$mybb->settings['bburl']."/member.php?action=register\">Please Register to see links</a>",$content);
}
return $content;
}
?>
(2012-01-06, 12:24 AM)svr2009wwe Wrote: [ -> ]OK, just make a new plugin by your self.
Here I will post a basic code.
Make a file called onlyreglinks.php in you "inc/plugins" folder
<?php if(!defined("IN_MYBB")) die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); $plugins->add_hook("parse_message", "onlyreglinks"); function onlyreglinks_info() { return array( "name" => "Registered Members Links", "description" => "Links for only registered members", "author" => "your name", "version" => "1.0.0", "compatibility" => "16*" ); } function onlyreglinks_active() { } function onlyreglinks_deactive() { } function onlyreglinks($content) { global $mybb; if($mybb->user['usergroup'] < 2) { $content = preg_replace("/<a href=\"(.*?)\" target=\"(.*?)\">(.*?)<\/a>/is","<a href=\"".$mybb->settings['bburl']."/member.php?action=register\">Please Register to see links ".$mybb->users['uid'] ."</a>",$content); } return $content; } ?>
Now just Active this plugin.
I've not tried this. If this does not work then reply immediately.
".$mybb->users['uid'] ."
from the script. I just put that when I was checking. Or it might display user id too.(2012-01-06, 06:44 AM)svr2009wwe Wrote: [ -> ]No problem man. And can you expand your last question? I didn't quite catch that..
And one more thing.. Please removefrom the script. I just put that when I was checking. Or it might display user id too.".$mybb->users['uid'] ."
$content = preg_replace("/<img src=\"(.*?)\" border=\"(.*?)\" alt=\"(.*?)\" \/>/is","<a href=\"".$mybb->settings['bburl']."/member.php?action=register\">Please Register to see Image</a>",$content);
if($mybb->user['usergroup'] < 2) {
// INSERT THAT CODE HERE IN YOUR"ONLEYREGLINKS.PHP" FILE
$content = preg_replace("/<a href=\"(.*?)\" target=\"(.*?)\">(.*?)<\/a>/is"....