Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
coding-topic
Add an action button/link for each post
Avatar
Yehonal
Member
sp_UserOfflineSmall Offline
Nov 28, 2015 - 1:49 pm

Hi simple-press community. 

I'm looking for a way to add contents programmatically to a post/reply. I need something like a button , visible by administrators, that redirects to the mycred_edit_balance admin page where i can "adjust"arbitrarily the amount of mycred points for the post/reply author.

Is there any action/filter that i can use to add such functionality?

should i use child theme instead?

Thank in advance

Avatar
Ike
Sawtry, UK
Member
Free Members
sp_UserOfflineSmall Offline
Nov 28, 2015 - 2:50 pm

Hey Yehonal,

Unfortunately this is a bit beyond my knowledge so will have to wait for Steve or Andy - Being a weekend and a public holiday in the States time is a bit scarce but hopefully one of them will be around soon.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Nov 28, 2015 - 3:20 pm

not entirely sure I follow what you want to do... you just want to add a button that links to a mycred page?

if so, have you looked at:  https://simple-press.com/docum.....addbutton/

lets you add a standard button linking to where ever you want...

if you only want it shown to admins, then something like:

if ($spThisUser->admin) sp_AddButton();

of course, adjust arguments to the function call to meet your needs...

If this is not what you meant, please elaborate...

Avatar
Yehonal
Member
sp_UserOfflineSmall Offline
Dec 2, 2015 - 9:36 am

Thank you very much!

It's exactly what i was looking for. It is the button i've created using an action :

 add_action('sph_BeforeSectionEnd_action', function() {
 global $spThisPost,$spThisUser;
 
 if ($spThisUser->admin) {
 sp_AddButton(sp_AddButton('tagClass=spButton spRight&icon=sp-logo-tiny.png&link='.urlencode('/wp-admin/users.php?page=mycred-edit-balance&user_id='.$spThisPost->user_id.'&ctype=mycred_default'), __('Adjust Points'), __('Adjust Points for this user'), 0, 'spLogoButton'));
 }
});
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Dec 2, 2015 - 10:57 am

That's  great news. Excellent use of the tag and glad it managed to get you what you wanted. Thanks for letting us know.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 649
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 618
Members: 17357
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10123
Posts: 79616