davelester / WPBadgeDisplay

WordPress plugin that creates a widget to display Open Badges on your blog.
Other
12 stars 8 forks source link

automatic retrieval of email address if shortcode called on author page #3

Open davelester opened 12 years ago

davelester commented 12 years ago

Shortcodes work (or will.. soon!) if an email address or WordPress username is specified. If the username is specified, the plugin looks for the user's email address. Email addresses are what is used to pull a list of badges from Mozilla. But let's say I wanted to include the [openbadges] shortcode on an author page, which is specific to an individual and dynamic?

I'd like to automatically detect if a shortcode is being called on an author page, and if so retrieve the author email to display badges. Yes, it's possible to do this manually, but this approach will keep the shortcode syntax concise.

boonebgorges commented 12 years ago

Hey Dave, I've got a client who wants some of this.

But let's say I wanted to include the [openbadges] shortcode on an author page, which is specific to an individual and dynamic?

An "author page" is an archive of posts by a given author. You can't include a shortcode on this kind of page.

But I think the question of email fallbacks is good for the shortcode more generally. For many (most?) use cases, WPBadgeDisplay will be installed on a single-author blog. So I think we can fairly safely assume that when the shortcode is called, the intended email address is either the post author, or the site admin (which may be one in the same).

I'll send a pull request in a moment with my suggested change.