vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Default Sigs (https://vborg.vbsupport.ru/showthread.php?t=264238)

Evertonized 05-26-2011 10:43 AM

Default Sigs
 
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,

PHP Code:

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




Basically,
  1. go to your AdminCP.
  2. Expand "Plugins & Products"
  3. Click "Add New Plugin"

On this page,
  1. Leaving "Product" as vBulletin is just fine.
  2. Choose postbit_display_complete as your hook.
  3. 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.
  4. Execution Order can be left at the default of 5.
  5. Put in the PHP Code I provided.
  6. 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. :>

PHP Code:

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.

Code:

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:
PHP Code:

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

Quote:

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

Quote:

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.

Quote:

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.

Quote:

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.

Quote:

Do you want anyone to be ABLE to change their sigs?
No, not in this group as mentioned above.

Quote:

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.


All times are GMT. The time now is 03:39 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01044 seconds
  • Memory Usage 1,749KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete