MyBB Community Forums

Full Version: How to Create in post For all member An button to..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
hi i want to Create a button in Thread when Member create a Thread they have A button Named Secure *Example.. and when they click on that is Show A Code to copy what i mean a code Is that

[lock cost="1" title="super secret content"]
https://mywebsite.com
[/lock]



is offer The possibility to use that code to Secure her content is the code of Ougc Lock content .. if they want they can copy and past in her thread To Made 1 or More secured Content with Default Cost of 1 ..

the Other possibility is To create A button is ask to enter an url and when they click on add is add in her post the url secured but Is not offer the possibility To add 2 Link Secured by that code

[lock cost="1" title="super secret content"]
https://mywebsite.com/
[/lock]



*Note My website.com is an Example to offer possibility to Enter her url of Website or content to Secure..
It depends on the editor you use, the methods aren't the same for each editor
I am new into mybb i use the default theme ofmybb, with last version of mybb Where i can see what editor i use ? i think is the default ? and If i use the default How do what i requested here ? i think is only code to add in template ?
(2020-08-03, 10:55 AM)HighRank2267 Wrote: [ -> ]i think is only code to add in template ?
No, its more complicated.

If you just want a button in the left side (under the smilie picker for example), you can simply modify the template to add the button and the javascript it needs, but I don't find it's a proper way, creating a plugin is better imho.
If you want a button in the MyCode (above the text edition), it's more complicated, you'll have to change core files (js, css, some php files) and it won't be keeped each time you upgrade your forum.

The basic code for a simple button is something looking like:
<input type="button" onclick="MyBBEditor.insertText('[lock cost="1" title="Your title"]Your content[/lock]'); return false;" value="Locked content" />
I understand i dont have the smile option i have find Thread template And add it is not correctly placed in good place but when i click on the button is made Nothing wrong line code ... surely Because i see Return False on click in your command line is mean Made nothing..!

but I have found how to add the lock command in all Thread but Is not the best way to Give the Option to member and Without any explain if they see the entire code Is not Better of having A button to click on it and Is ask to insert a link or content To securing the link or Content.

Does Is possible On Every Thread to Add Without Javascript. a Way To Show the command line If user needed to Secure her content and explained how to use, Maybe i need to made 1 post with explain How To Use The Code What i Asking now Is not to create a button to made The Content secure but i am asking now to Made a button when they click on it is show the code To use and with Descriptions ..

[lock cost="1" title="super secret content"]
https://mywebsite.com/
[/lock]
First: "return false" is just a way to say "now, stop your process". So it will stop after having done the insertText().
Second: The code was an example, not tested, so adapt it to make it work.
Third: impossible to do what you want without JS
Fourth: if you want an "assistant" to fill the MyCode, you'll have to use an heavier JS

And I won't help for localhost forums.

Good luck malcom5322 / HighRank2267 / whatever the name you'll use
(2020-08-03, 12:54 PM)Crazycat Wrote: [ -> ]First: "return false" is just a way to say "now, stop your process". So it will stop after having done the insertText().
Second: The code was an example, not tested, so adapt it to make it work.
Third: impossible to do what you want without JS
Fourth: if you want an "assistant" to fill the MyCode, you'll have to use an heavier JS

And I won't help for localhost forums.

Good luck malcom5322 / HighRank2267 / whatever the name you'll use


I Only requested For help okais now I understand About stop your process code .. Well without js not possible okais i have found without js but need to create thread Confused .. I dont See what is Serve To say good luck For wathever the name i use is not the question Even if i have 1account or 50 .. I use That account for request help.

thank for the time and help.
Working code is: <input class="button" type="submit" onclick="MyBBEditor.insertText('[lock cost=\'1\' title=\'Your title\']Your content[/lock]'); return false;" value="Locked content" />
But as said previously, if you want a form to help user to fill the code, you'll need something more complex to create a modal form with the correct fields and treat them.
(2020-08-03, 01:04 PM)HighRank2267 Wrote: [ -> ]I Only requested For help okais now I understand About stop your process code .. Well without js not possible okais i have found without js but need to create thread Confused .. I dont See what is Serve To say good luck For wathever the name i use is not the question Even if i have 1account or 50 .. I use That account for request help.

thank for the time and help.

Not true I'm afraid.  See section 5 of the forum rules:

https://community.mybb.com/thread-74201.html

Not my concern really, but wouldn't want anyone to think otherwise....
(2020-08-03, 07:36 PM)nixer55 Wrote: [ -> ]
(2020-08-03, 01:04 PM)HighRank2267 Wrote: [ -> ]I Only requested For help okais now I understand About stop your process code .. Well without js not possible okais i have found without js but need to create thread Confused .. I dont See what is Serve To say good luck For wathever the name i use is not the question Even if i have 1account or 50 .. I use That account for request help.

thank for the time and help.

Not true I'm afraid.  See section 5 of the forum rules:

https://community.mybb.com/thread-74201.html

Not my concern really, but wouldn't want anyone to think otherwise....
ohh my fault .. i dont have see the rule but For Private reason i now Dont have Acces to another account and arleady made 1 request for Deletion , Good day

(2020-08-03, 01:18 PM)Crazycat Wrote: [ -> ]Working code is: <input class="button" type="submit" onclick="MyBBEditor.insertText('[lock cost=\'1\' title=\'Your title\']Your content[/lock]'); return false;" value="Locked content" />
But as said previously, if you want a form to help user to fill the code, you'll need something more complex to create a modal form with the correct fields and treat them.
thanks you i have tested That probably my fault but in Show thread temaplate i have add the button Without tittle and post i just try toclick on thebutton is ask a tittle and a Post content I add it and click on lock content and I dont click on Summit .. but Is made a summit and when the Thread are posted is not working is just a summit button like normal :?

I understand Is need more of that like your Explained , Thanks you for Time
Pages: 1 2