PDA

View Full Version : Default Sigs


Evertonized
05-26-2011, 10:43 AM
Hi Guys,

Is there a way to display default signatures on posts, if a user hasn't set one?

Thanks
Steven

Sarteck
05-26-2011, 10:56 AM
On the hook postbit_display_complete, you could add some PHP Code as a Plugin to test for the existence of a signature, and if it's absent, then put in your code.

For example,


if (!$post['signature'])
{
$this->post['signature'] == 'THIS IS A DEFAULT SIGGY!';
}




Basically,


go to your AdminCP.
Expand "Plugins & Products"
Click "Add New Plugin"


On this page,


Leaving "Product" as vBulletin is just fine.
Choose postbit_display_complete as your hook.
Put in a descriptive title. "That Genius Sarteck's Solution for our Default Sigs!" springs to mind, but you can title it however you want.
Execution Order can be left at the default of 5.
Put in the PHP Code I provided.
Make sure that the Plugin is NOT active, at first.


Save and Reload.

Now, in another tab/window, open up a thread with someone who has no signature. Go back to your AdminCP (should still be on the Plugin you created since you saved and reloaded WITHOUT activating it). Now go ahead and choose "Yes" to activate it, then reload your thread, look, and if it works, great! If not, you come back here and say, "DAMN IT, SARTECK, YOU'RE A NINCOMPOOP FOR GIVING ME FALSE INSTRUCTIONS." And then we'll take it from there.

EDIT: P.S., setting the Plugin to "No" for it's activity is good if it doesn't work, too, so no one gets errors.

kaype
05-26-2011, 07:00 PM
Hi Sarteck, looks like a easy solution. But what if I need an auto-signature to be assigned to all members of particular usergroup? Is there a similar easy solution?

Evertonized
05-26-2011, 08:44 PM
DAMN IT, SARTECK, YOU'RE A NINCOMPOOP FOR GIVING ME FALSE INSTRUCTIONS.

And I had thought of a really good plugin name, to say thank you - but I'll tell you it, once/if we get it working :P

Thanks for helping btw.

Sarteck
05-26-2011, 09:09 PM
@kaype, there is indeed.

You can test for the user belonging to a specific usergroup by adding a little bit to the IF block, like so. :>


if (!$post['signature'])
{
if (is_member_of($this->post, $my_usergroup_here))
{
$this->post['signature'] = 'THIS IS A DEFAULT USERGROUP SIGGY!';
}
else
{
$this->post['signature'] = 'THIS IS A DEFAULT SIGGY!';
}
}






@Evertonized, I made a booboo in my code. (Forgive me, it was before I went to bed. XD) There should only be a SINGLE equal sign for assignment.

I had you putting,
$this->post['signature'] == 'THIS IS A DEFAULT SIGGY!';

It should be,
$this->post['signature'] = 'THIS IS A DEFAULT SIGGY!';

kaype
05-26-2011, 09:59 PM
Gr8, thanks !

But guess I don't need the below code as I want to force the signature for all users in that group.

else
{
$this->post['signature'] = 'THIS IS A DEFAULT SIGGY!';
}


Also is there a way to set/force this on registration to a certain group? Like all users registering from X location will go into X group and they will will have a preset signature.

Sarteck
05-26-2011, 10:13 PM
@kaype, if you want to force the same signature for all users in a group, a slightly different method should be used:

if (is_member_of($this->post, $my_usergroup_here))
{
$this->post['signature'] = 'THIS IS A FORCED USERGROUP SIGGY!';
}


That will assign the signature to all members of a group, regardless of what they put in their signature box.



Forcing it on registration to a certain group is possible, too, but it would require some different methods. It also depends on if you want users to be able to change their signature at a later date. (The method above will not allow them to change their signature while they are a member of that group. Well, more accurately, they can make all the changes they want, but that sig you set will always be what shows up.)

kaype
05-26-2011, 11:33 PM
Forcing it on registration to a certain group is possible, too, but it would require some different methods. It also depends on if you want users to be able to change their signature at a later date.

Can you let plz me know how to do this, as I am interested in set/force it on registration to a certain group.

Sarteck
05-26-2011, 11:52 PM
Well, I gotta know what it is you want. XP

You want, upon registration, for users to be placed into a group other than Registered Users?

And you want this group to be forced to wear a certain signature?

And you want this group to not be able to change their Sigs?

Do you want anyone to be ABLE to change their sigs? Does your Administrative staff have to manually move users out of the group in order for them to use sigs normally?

kaype
05-27-2011, 12:11 AM
You want, upon registration, for users to be placed into a group other than Registered Users?


Yes, and I know how to do that. That is not what I am looking for.

And you want this group to be forced to wear a certain signature?


Yes, that is right. On signup or if admins/mods change a users usergroup. Basically any user with that user group should have this sig.

And you want this group to not be able to change their Sigs?


No, they cannot. Maybe admins can add a second sig if needed for a few user. But that is not important.

Do you want anyone to be ABLE to change their sigs?

No, not in this group as mentioned above.

Does your Administrative staff have to manually move users out of the group in order for them to use sigs normally?
Again, I think I have answered this - maybe admins can add a second sig if needed for a few user. But NOT change the primary preset sig.

xrvel
08-20-2011, 02:44 PM
Closed