Forum Replies Created
-
AuthorPosts
-
February 11, 2013 at 9:31 am in reply to: How can I remove the Eventbrite API key field from registraion/profile form? #32425AlekParticipant
Yes, I am still seeing the API Key field within WP profile pages. Using the following code. The only change was to add user ID 12 to the allow list.
/**
* Hides the Eventbrite Tickets fields from user profiles, unless the user is on the exception
* list.
*/
class EventbriteProfileFieldsHider {
protected $exceptionList = array(1);/**
* Any users who still need to see the Eventbrite Tickets fields in their profile should be
* specified as an array of integers. By default, if no arguments are passed in, it is assumed
* that they should still be visible for user #1 (the normal root admin).
*
* @param array $exceptions
*/
public function __construct(array $exceptions = null) {
// Change the default exception list (which is just user #1 - the default admin in most cases)
if ($exceptions !== null) $this->exceptionList = $exceptions;// Conditionally remove the Eventbrite Tickets fields from the user profile
add_action('admin_init', array($this, 'maybeRemoveFields'), 50);
}public function maybeRemoveFields() {
$user = wp_get_current_user();if (is_object($user) and isset($user->ID) and !in_array($user->ID, $this->exceptionList)) {
$eventbriteTickets = Event_Tickets_PRO::instance();
remove_action('show_user_profile', array($eventbriteTickets, 'userProfilePage'));
remove_action('edit_user_profile', array($eventbriteTickets, 'userProfilePage'));
}
}
}// Let the (Eventbrite Tickets profile) fields be visible for the following users (by ID)
$allow = array(1, 2, 12);// Hide the fields for everyone else
new EventbriteProfileFieldsHider($allow);
February 5, 2013 at 2:30 pm in reply to: How can I remove the Eventbrite API key field from registraion/profile form? #32167AlekParticipantThanks for the suggestion. I tried adding that code and it seems to have no effect. It’s probably conflicting with either or both plugins mentioned above. Unfortunately WP is not wrapping the label or field in or anything at all, so there is not way I can hide via CSS. Any other ideas?
AlekParticipantThanks. For some reason, the plugin was not loading some .js files. I just found what files were needed by looking at the demo and added those manually. Not sure why they weren’t loaded automatically, but it’s working now, so good enough!
-
AuthorPosts