Mod Name / Version - Custom Title 2.2 ver 2.0 Updates to work with ver 6.2 and adds the ability to let only a specific user group change their titles. ver 2.1 Adds a check to make sure the user doesn't leave the title blank. ver 2.2 Fixes a bug where the title was getting lost on users who weren't part of the special user group. (Thanks to Leo at leoville.com for pointing out this bug. )
Description - Gives Users of a specific usergroup the ability to change their own titles.
Version 2.1 adds a check to make sure the title isn't left blank.
If you've already installed version 2.0, here's how you can make the change:
code: ## ## In your modified changebasic.php file ##
# # Find this: #
// -------------------------------------------------- // If title is greater than 100 then we can't proceed if ( strlen($Title) > 100 ) { $html -> not_right($ubbt_lang['TITLE_TOO_LONG'],$Cat); }
# # Change to this: #
// -------------------------------------------------- // If title is greater than 100 or blank then we can't proceed if (( strlen($Title) > 100 ) || (!$Title)) { $html -> not_right($ubbt_lang['TITLE_TOO_LONG'],$Cat); }
## ## In the modified /languages/english/changebasic.php file ##
# # Find this: #
$ubbt_lang['TITLE_TOO_LONG'] = "Title too long.";
# # Change to this: #
$ubbt_lang['TITLE_TOO_LONG'] = "Your Title is either too long, or blank.";
ver 2.2 Fixes a bug where the title was getting lost on users who weren't part of the special user group. (Thanks to Leo at leoville.com for pointing out this bug. )
code: If you already installed, in your modified editbasic.php find this:
else { $CustomTitle = ""; }
Change to this:
else { $CustomTitle = "<input type ="hidden" name = "Title" value = "$UserTitle" />"; }
Hey, cool! I'm glad someone finally got around to doing this. Unfortunately, I don't have a copy of 6.2 so I couldn't do anything with it. Eventually when I get some cash I'll purchase the latest version.
I was using it...... Gotta still add it to 6.2 so it'll work with the birthday hack.... Right now I'm choosing b-day until I get the energy to add it.......hehe Great hack though.....
Some people read their stars..... I choose to write my own
I added the BDay hack to my 6.2 board and it works fine. I edited out the display for the year of birth, as some of my members are shy about their ages.
I'm now trying to add the Custom User Title hack, which uses some of the files I already hacked in the Birthday feature. I can't seem to get Custom Titles working properly.
-- at no point after I installed the hack did I ever see a "Custom Title" box in my profile. However, if I tried to submit other changes to my profile, I'd get a "We can't proceed; title too long or blank" error message.
-- I wasn't exactly clear on how to substitute the group number in editbasic.php. Am I to replace -5- with just 3 (for example), or do I replace it with -3- ?
-- in places where the BDay Hack and the Custom Title hack both affect the same area of code, which hack snippet goes first?
First - list the group number like this -3- with the dashes. That's how it can tell 3 apart from 30.
As per areas that are affected by the two hacks....
Basically the
SELECT U_LoginName,U_Password,U_Email.......
line as well as the
list($LoginName,$ChosenPassword,$Email....
line
If those lines have already been modified from another hack... be sure to add the fields to the end of each line... rather than replacing the whole line.
so at the end of the SELECT line, you'll add: U_Groups and at the end of the list line, you'll add: $Groups. That way the Birthday fields and variables for the other mod remain intact.
what if you want to allow multiple groups the ability to alter their titles? For example I have 4 different groups I'd like to allow custom titles for. But not sure how to make this happen
Hmm, ok, I have a problem. Even before I added the multiple groups addition, everyone on the site is receiving this error when trying to update their profile:
[]Your Title is either too long, or blank. [/]
I thought adding the multiple groups thing would maybe eliminate this, but alas it did not. So as of right now, nobody can update their profile as it gives them that error. Any ideas?
hmm, I think it is your birthday hack conflicting with your custom title hack. I applied the title hack first, THEN the birthday hack... but then went back and looked and saw a lot of the group hack stuff has been overwritten by the birthday hack So no neither work *cry*
Add the stuff into the SELECT and list lines... don't copy and paste over those lines if you are doing more than one hack.... you have to add the Birtgday fields to the end of those lines....leaving the Title field in there as well.
If you overwrite the title field, and it's not in there being pulled from the DB then it is blank.
I just want to say thanks again. This hack has been by FAR the biggest revenue generator of all time! I announced that donating members receive the ability to make a custom title. Well, once people started seeing the fun titles were coming up with everyone was like "HEY! I want a custom title too!" So in the past few days, my paypal account has had over 200 dollars in donations!!!
I thought giving them 20 megs of photo storage was enough, but what they really wanted was the custom titles All I know is if this keeps up I will have the server completely paid for before spring
Hey Josh.. sorry to bring up an old thread, but I was trying to get this to work for 6.3.
And, it does... well, 99% of it does. The only problem is with users who do not have the ability to set custom title.. they can't edit their profiles anymore because they get the "Title is too long or empty" message
Not sure what in 6.3 would have changed to cause this.. but if you could take a look at it, that would be great
Hmm.. while I think I know how to add the field.. I have no idea how to make threads check the group to determine whether or not to make the field visible or hidden. That is a bit beyond me
Hmm.. I just got a PM from one of my users, and they "hacked" their title and they were not supposed to be. He said he was viewing the source, found a hidden textbox for the title... and he said he was able to go in and set a title
Hmm.. ok, there was no get_input for the title variable.. so I went ahead and added a line to do this with the rest of the get inputs. Unfortunately, that did not work.
Also, what I have noticed, is for the people who are able to change their titles, you can change it fine. But when you go back to your profile, the title box is blank, even though you do have a custom title.
I don't remember if this is how it worked in the past, but so far that and the inability for people to not change their profile w/o a custom title are the only two issues I see at this time
For now, I have just commented out this section:
Code
// -------------------------------------------------- <br />// If title is greater than 100 or blank then we can't proceed <br /> if (( strlen($Title) > 100 ) || (!$Title)) { <br /> $html -> not_right($ubbt_lang['TITLE_TOO_LONG'],$Cat); <br /> } <br />
And it at least allows users who can't set a title to update their profile, but the too long and blank checks are gone. So that is a temporary solution anyway
For people without the ability to change the title - there should be the <input type="hidden" for the title. I just checked these instructions and I see it in there.
Does your changebasic.php have this in it?
Code
<br /> else {<br /> $CustomTitle = "<input type =\"hidden\" name = \"Title\" value = \"$UserTitle\" />";<br /> }<br />
That should pass the title from one script to another if they aren't allowed to change it.
That line is not in changebasic... but it is in editbasic, as per the instructions. And it does work correctly, as I created a test user who doesn't have title changing access, and the title field does not display, and is hidden. But even since it was hidden, it was still showing up as blank.
I think this has to do with why all title boxes are blank. Like I mentioned, I can set my own custom title, and it displays on the forum right. But as soon as I go back to edit my profile, the Title formbox is blank.. so it looks like the script isn't picking up the existing title and entering it into the box
Hey Josh, I fixed the hack somehow (Not sure how since I'm a complete idiot when it comes to messing with code)
But anyway, there was a variable change I believe in 6.3.. from $UserTitle to just $Title. Also, in the editbasic script, it looked like the query was not pulling the title information, so by simply adding that to the query, and changing the $UserTitle to $Title, it seems to be working.
The titles now display in the textbox, only the proper users are allowed to edit their title, and users don't get the "too long or blank" message anymore
So updating your instructions shouldn't be too hard at all
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.