MyBB Community Forums

Full Version: Adding a modal login box to MyBB using jQuery
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
There's nothing wrong necessarily, but the modal only shows when I click the link in the header. It doesn't work globally, though I could probably add a class/id to the images to hijack the action.

What I have figured out is stopping me is that no matter what group the user is in, the same showthread_newreply button is shown. Therefore, if I just add a name="modal" bit to it, it breaks all functionality for logged in users (shows just the mask). I know I could install PHP in Templates, but I don't want that security risk.

Maybe 1.8 and CSS buttons will help. If it works like I think, then a different button could be shown to guests from MyBB itself, and I could hijack just that button. But right now, I can't do much without a lot of work.

I suppose I could pop open showthread.php, create a new template, and if the user's ID is 0 (Guest), then a different showthread_newreply_guest template is eval'd. But then I need to forward the user to newreply, which is stopped by the event.preventDefault in the JavaScript. I suppose I could add a toURL variable in the JS, capture that, then forward. But then that variable would not be used 90% of the time and could break other parts of the forum.
Or you could set the class like newreplybutton_{$mybb->user['usergroup']} so the class would include the usergroup ID for you to select only for guests.
(2012-08-20, 09:14 PM)euantor Wrote: [ -> ]Or you could set the class like newreplybutton_{$mybb->user['usergroup']} so the class would include the usergroup ID for you to select only for guests.

Hmm... That's not a bad idea. I've never thought of using the variables for something like that.
Then obviously you haven't followed the tutorial correctly. It works perfectly fine for everybody else.
really nice tutorial mate
i'm using it on my site , thanks!
looking forward to see more HQ tutorials from you
Sorry euantor, but I followed the tutorial verbatim, twice. I copied all the code into the stylesheets and templates. Maybe it has to do with me using an Audentio theme: they seem to name some classes differently.
Weird, I'll have to look at it properly when I get home from my vacation and see if I can spot the issue for you.
Well I will try adding the group ID onto the end of the class, because I should just be able to add it to the selector and have it work.
Yeah, it should work but you'll obviously have to modify the JS a little.
I'll figure it out eventually. But that's just a minor quirk. I am thinking though about redesigning the showthread a bit, as per the humanization ideas. The way I visualize it is awesome. Whenever I get a custom theme, I will probably have the designer help me a bit with tweaking that design stuff a bit.

Well I sorta got it worked out. But then it returns to the thread page. I guess I will have to find a way to generate a toURL variable for use with only the newreply buttons..
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26