adding a post ID to a string – feedback please
-
I’m trying for two days now and I finally got it done..
It seems like everything is working fine, I get no PHP errors but I rather ask somebody professional first before I add this code to a tutorial so more people can benefit from this.
What I’m trying to do is create custom groups/series of badges that can be earned on my website through the myCRED plugin.
Everything goes fine at the start, there is a Post Type for the badges section created by the myCRED developers and I’ve added a (category style) Taxonomy to that Post Type so I can group multiple badges together in the admin section.
** Still need to find out how I can delete those badge_series (categories) because right now there is only an adding section **
This is what it looks like for logged_out users/visitors. They all get a list of all badges that can be earned in the comments section.
Screenshot.So far so good this wasn’t very difficult but adding a conditional tag to check if a user who”s logged_in has earned this badge before was a bit more complicated.
All badges are stored in the usermeta table like this. Just the badge name + ID attached to it.So I thought let’s try and glue the post_ID against the meta_key column when asking for it but I don’t know if that’s correct.
Please take a look at my code.
The function still_at_work() at line 69 I attached the Post_ID against the meta_key and I don’t know it’s that’s correct.
Here is my code (pastebin)It looks like it’s working in the end.
screenshot final
The topic ‘adding a post ID to a string – feedback please’ is closed to new replies.