The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Can I change a cpnav group phrase by php ?
Hello everyone, I have been trying to figure out how I can change a phrase that belongs to a cpnav subgroup which would be triggered by a click or "save" from the user. Allow me to elaborate...
I have this before: When the user goes to contest 1 for the first time and configures the initial options, specifying a name (in this case for example: Signature Of The Week), etc, after clicking "save" at the bottom of the page, I want the "Contest 1" subgroup to change to the name the user specified in said options; like so: If anyone has any ideas or information that might be useful please do share your thoughts. Any feedback is good feedback. Thanks for your time everyone. P.S.: FYI I edited the phrase manually this time to show what I wanted . |
#2
|
|||
|
|||
How is that menu being created?
|
#3
|
|||
|
|||
By the xml file I created that I included in xml directory in includes .... pardon my redundancy. --------------- Added [DATE]1312238087[/DATE] at [TIME]1312238087[/TIME] --------------- here you go: PHP Code:
if you mean how I changed it that time I did it manually going to phrase manager , etc, etc, for the effects to demonstrate what I wanted to be done but via php user submission not phrase manager. |
#4
|
|||
|
|||
Save the new phrase in the database phrase table.
Code:
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "phrase SET text = '" . $newtext . "' WHERE varname = '" . $yourphrasename . "' "); |
#5
|
|||
|
|||
Quote:
Testing now... --------------- Added [DATE]1312240116[/DATE] at [TIME]1312240116[/TIME] --------------- OK well it changed it in the table but not in the actual menu...weird... I refresh the page and it still says Contest 2 I am using this file to test and I can verify it changes the phrase text because I see it in the SQL table in phpmyadmin. PHP Code:
And I can also verify that the phrase changed because I see it in the phrase manager... still same though in the actual menu in admin cp, still reads: Contest 2... |
#6
|
||||
|
||||
Typically you'd use a "Manage Contests" link, rather than having dynamic navigation (vBulletin wasn't really built for that).
Updating the phrase works (ideally as a translation*) as well. If you want to do it dynamically, create a new plugin at the admin_index_navigation hook with something like this: PHP Code:
|
Благодарность от: | ||
nhawk |
#7
|
|||
|
|||
Quote:
Thanks for your replies everyone. I was successful now changing it from the php that nhawk gave ; the only reason it was not working before was because it needed to update the translated field not the actual text ( as suggested by Adrian ). I created that plug-in although all the subnav options disappear. This is the plugin I used: PHP Code:
Any help will be appreciated. |
#8
|
||||
|
||||
I don't have time today to try and get it working again, but that general structure worked for me with a quick test.
You'd just link to contests.php, which pulls a list of templates from the database with view/edit/delete (for example) options. Pretty standard stuff as far as admin pages go. You never see dynamic ones on the left (Style Manager vs. listing each style). Look through some of the files under the admincp to see what I mean. Cheers |
#9
|
|||
|
|||
Ok. I just got done reading this tutorial (https://vborg.vbsupport.ru/showthread.php?t=83122); which is a bit old but apparently still valid for what I want. How about this for what I want to accomplish...
I have this file which is used for one of the contest options for example. If the user has not entered a new name for the contest to "activate" it then he get's the form to enter the name if not he get's the rest of the options. Now with this when the user enters a name and saves the phrase will be changed and the other options would appear. My question would be how do I make the form "submit" button run the SQL commands to change the phrase once the user hit's said button? Here's my code: PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|