miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Specific miniBB Support Forums / Specific /   
 

Only showing a button when in a particular forum?

 
Author Bluesplayer
Partaker
#1 | Posted: 27 Aug 2020 23:54 
Minibb rocks as far as I am concerned. I am always thinking of ways to use it in an unaccustomed manner. Not sure Paul will like this, but I have not created a button so that users will be able to sell stuff using Paypal. Dead easy really. All users have to do is use the button email link that Paypal provides. Input this link underneath the product details and the job is done. Saves having to use bloated Wordpress or something similar. Here is my question though: how do I hide the button so that it only shows when a user is logged in? I have hidden it using javascript so that it only shows within a particular forum. I now need to hide it further.

Author Bluesplayer
Partaker
#2 | Posted: 27 Aug 2020 23:58 
Eh? Why can't I edit my initial post without a warning showing?

Author Bluesplayer
Partaker
#3 | Posted: 28 Aug 2020 00:00 
Paul, you are an amazing coder but, hell, you are so strict at all times.

Author Paul
Lead Developer
#4 | Posted: 31 Aug 2020 11:31 | Edited: Paul 
Bluesplayer:
Why can't I edit my initial post without a warning showing?

On this forum, you could edit your message only within 5 minutes since its posting. It's a limitation for this forum only, gained from practice. On your forum, the miniBB software allows to set up any rules you want.

Closer to your issue: you have to put the code into a variable and then build this variable in bb_plugins.php like in a following way:

if($user_id==0) $loggedPayPalBtn='';
else {
$loggedPayPalBtn=<<<out
//here goes the code for your PayPal button or any other

out;
}

then in some template you prefer, like templates/main_topics.html for example, put this:

{$loggedPayPalBtn}

This could be used for any kind of codes, separating them from guests/members.

However I'm not sure how do you insert the button in your posts (is it straight HTML in a template, or is it kind of dynamic code inserted in database), so this above could have a correction, if you provide more infos or if it doesn't work.

Author Bluesplayer
Partaker
#5 | Posted: 31 Aug 2020 12:34 
Thanks Paul.

I have already worked out the above. All is well now.

Sorry, I had had one too many when making my initial post. It made me a little cranky to say the least.

Author Bluesplayer
Partaker
#6 | Posted: 31 Aug 2020 12:54 
In the interim I have also reworked all the coding related to images. All thumbs now activate Fancybox. Seemed to make sense to do so when uploading and creating a gallery using the file upload script to sell something, something similar to Ebay. Instead of viewing each image separately you can just scroll through them. I have also added it to the other thumb images so they show the original image when in the Fancybox environment. All a bit of fun really as I enjoy messing with code. The end product can be seen here ...

http://brainwaving.co.uk/forum/index.php?action=vthread&forum=24&topic=18

Of course, the advert has a limited shelf life and will have to be taken down at some point.

Author Paul
Lead Developer
#7 | Posted: 31 Aug 2020 15:02 
Thanks for letting me know about Fancybox, it looks promising, much better than Lightbox I knew earlier about. In my plans there was an idea to extned File Uploads add-on with something like this, and so far it looks the best 3rd party for this purpose. I'll take a closer look when developing further releases of this add-on (but it would be an optional extension anyways).

Author Paul
Lead Developer
#8 | Posted: 1 Sep 2020 18:25 
Bluesplayer:
Sorry, I had had one too many when making my initial post. It made me a little cranky to say the least.

It's a big advantage for me to see any reaction, 'cause it allows to fix errors in the software :)

Another user reported the same issue as yours, so it's now fixed here on miniBB forum.

Thank you for this notice, too! Makes sense.

Author Bluesplayer
Partaker
#9 | Posted: 1 Sep 2020 18:25 
I have been messing around again! I now have a like and dislike box underneath the initial post. The script worked off sessions, but I found this quite confusing. As a work-around I altered the database fields so that larger entries would be accepted and then coupled the script to ip addresses instead. I have asked the guy who created the code in the first place how to show the box multiple times on the same page so that it can be used underneath all the replies too (only the first works). Unique values were quite easy to obtain for the post_id — I created a new variable in bb_func_vthread that displays the forum ID, topic ID and the msg number. To overcome the display showing multiple times in main_posts_cell I created some javascript that searches for a div ID. Should it find the div ID it then hides any further div of the same ID. Works for now. Hopefully a fix can be worked out in time and I can then display the box underneath the initial post and the replies. I could show the box only for logged in users. In time I think I should be able to match it to the user_id. Enough messing for now though.

The script I used can be found here ...

https://code-boxx.com/php-like-dislike-system/

Any post on my forum shows the code, such as this one (notice no code under the reply)

http://brainwaving.co.uk/forum/index.php?action=vthread&forum=2&topic=22

Author Paul
Lead Developer
#10 | Posted: 1 Sep 2020 18:42 | Edited: Paul 
Bluesplayer
Feeling confused — we discussed the PayPal button? Now it comes the Likes/Dislikes system? It needs a standalone thread then... am I right?

I was thinking about developing of my own version of the Like/Dislike buttons. I already have some dev.scripts from the past, but they are too specific, and this system should be pretty simple and fast. So it's in my plans to develop it in the near future.

Author Bluesplayer
Partaker
#11 | Posted: 1 Sep 2020 20:18 
Paul:
Feeling confused — we discussed the PayPal button? Now it comes the Likes/Dislikes system? It needs a standalone thread then... am I right?

Sounds like a good idea :)

As you say, the code is pretty straightforward. Not so much for me though as I have to use work-arounds for the stuff I don't understand (sessions got me confused), but for you to implement it wouldn't take a lot of effort I bet. Does it need sessions come to that? Just the user_id would be enough by all accounts. Anyway, I shall leave that to you. No-doubt though I will continue to mess with the code until I have it exactly as I want it (or very close).

I quite like the way this script works and they way it looks. Flashy just wouldn't look right. This one is nice and subtle, and as you say — fast too.

Author Bluesplayer
Partaker
#12 | Posted: 1 Sep 2020 23:42 | Edited: Bluesplayer 
One upgrade I am really looking into is a code block, where I can paste code without it parsing. This would be a great help to me. I like to write detailed explanations of some of my work but I am an unable to do so at the moment.

Specific miniBB Support Forums / Specific /
 Only showing a button when in a particular forum?
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


 ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
 ⇑