MyBB Community Forums

Full Version: Write my own custom MyCode to hide part of the posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I want to hide PART of posts from guests (aka non-members), like:
YOu have to log in to view the download links

I havent found a plugin for that now.so I am going to create my own MyCode.

I have read the tutorial here: http://community.mybb.com/thread-12008.html
Creating Custom MyCode

I am not an experienced PHP programmer however, though I have experience with Matlab and C++ etc

My custom MyCode would be:
[member][/member]

So when I wrap a paragraph with [member][/member], it will be only accessible to members.

If there some is_member() function in MyBB?

I need some hints. Please tell me the functions that may be useful to me.

Thanks a lot!

if you use php code to make a plugin type file for adding the mycode then
you can use the function variables to find if reader is a member or not ...
(2011-08-02, 11:47 AM)ranjani Wrote: [ -> ]if you use php code to make a plugin type file for adding the mycode then
you can use the function variables to find if reader is a member or not ...

Which function is it? thanx
in general, if($user['uid'] > 0) is used to find if a logged-in user (i.e. member) is viewing ...

Edit : more precise response is available below Smile
You can do something like this:

if ($mybb->user['usergroup'] != 1)
{
// Example
}
(2011-08-02, 12:05 PM)faviouz Wrote: [ -> ]You can do something like this:

if ($mybb->user['usergroup'] != 1)
{
// Example
}

Obviously you are an expert!
I will try and post my result here later.
OFF TOPIC : ^ of course, he is an expert Smile