Sean
Forum Replies Created
-
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] User (extended) pod type – HTMLPerfect. Tested this and works perfect. Thank you for your assistance, Jory. I will implement your recommendations.
Cheers!Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] User (extended) pod type – HTML@keraweb I totally appreciate that and will definitely investigate/debug on my end regarding the shortcode. However, the part of the issue which is relevant to you is not the shortcode, but an issue with the Pods plugin itself. (Admittedly, we went on a tangent when discussing the shortcode).
As mentioned, I have a
User (extended)
Pod Type. The purpose of this Pod is to add additional fields to my Users.One of the fields I created has the label
Program
and the namestaff_program
The Field Type is
Relationship
and related toSimple (custom defined list)
. Additional field options are aMultiple
Select Selection Type, with a format ofCheckboxes
.I have created a list of Custom Defined Options.
For the sake of example, here are my options:
Administration & Finance Client Services GIS & Planning Transportation
When I create a new User, if I select
Administration & Finance
orGIS & Planning
and save the User, the option does not save. I never had an issue with this Pod before. I’ve always been able to choose one of those options for a User and the value is stored when I save. If I selectClient Services
orTransportation
options and save the User, those options will save. Furthermore, I can see that existing users who previously had eitherAdministration & Finance
orGIS & Planning
options selected for thestaff_program
field still have that meta stored but if I were to uncheck that option, save, and then re-check it and save it does not get stored. So this new issue affects not only new users but also existing users if they get edited.After troubleshooting, I can say with confidence that the
&
character causes this problem. If I used the encoded ampersand&
the problem goes away. That leads me to believe there was a change in the Pods plugin that created this issue. I just want to know if that’s a bug because I certainly can’t believe I am the only one who uses an ampersand in options.You see, the solution to this problem is what I desire. Please disregard everything else about the shortcode, Jory.
PS. Thank you for this plugin and the continued development over the years. It is a great plugin with a quality build.
- This reply was modified 3 years, 11 months ago by Sean. Reason: Added troubleshooting info near end of reply
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] User (extended) pod type – HTMLAgain, my point is for over two years I have been able to user the special char
&
in aCustom Defined Option
for aSimple (custom defined list)
Relationship field
. Now whenever I select an option that contains that special char (in my example,Administration & Finance
and Save or Update a user, that option does not commit. It now only commits if I change the option in the Pod toAdministration & Finance
.Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] User (extended) pod type – HTMLYes, since I began using this function with Pods as a shortcode, I have used the special character
&
in the meta value forstaff_program
field as well as in the shortcode to display program staff. I’ve never converted it. As mentioned, now if the ampersand character is an option in the choice field the value does not save when I update a user.It now only works if I use the encoded HTML entity
&
on both the user entry side and the display side on the front end. (If you suggest I should always be using the encoded entity rather than the special char please let me know, PHP is not my native language, lol).For the
$args
, I have several custom userroles
defined. I useroles
to differentiate between our different levels of management. In the function above, I am looking forget_users()
who don’t have a management role and who match a program specified in the shortcode. IE:[TCOG_Program_Staff program="Administration & Finance" columns="1"]
will find allusers
withAdministration & Finance
meta_value in thestaff_program
field/meta_key. The users will be displayed in 1 column ordered bylast_name
.Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] User (extended) pod type – HTML@keraweb sorry for the delayed response as I have been out of office over the last week.
Oops! I pasted the wrong function. The below code includes the
program
argument and$atts
variable.// Displaying TCOG Program Staff in # columns based on program parameter [TCOG_Program_Staff program="Program Name" columns="#"] function display_tcog_program_staff($atts) { extract( shortcode_atts( array('program'=>'program','columns'=>'columns'), $atts) ); // $program = esc_attr($program); $column_count = esc_attr($columns); $col_class = $column_count; switch ($col_class) { default: $col_class = 'one-third'; case '1': $col_class = 'one'; break; case '2': $col_class = 'one-second'; break; case '3': $col_class = 'one-third'; break; case '4': $col_class = 'one-fourth'; break; case '5': $col_class = 'one-fifth'; break; case '6': $col_class = 'one-sixth'; break; } $args = array( 'role__not_in' => array( 'senior_leadership', 'program_manager', 'executive_director' ), 'meta_key' => 'staff_program', 'meta_value' => $program, 'meta_query' => array( 'lastname' => array('key' => 'last_name') ), 'orderby' => 'lastname', 'order' => 'ASC', ); $users = get_users($args); $current_col = 0; $colnums = $column_count - 1; // Number of Columns // $column_count += 1; $v = '<div class="mfn_heading heading_lines align_center"><h4 class="title" style="color:#3a80f1;"><span class="line line_l" style="background:#000;"></span>Program Staff<span class="line line_r" style="background:#000;"></span></h4></div>'; foreach ($users as $user) { // Let's make variables $staff_name = esc_attr($user->user_firstname) . ' ' . esc_attr($user->user_lastname); $staff_id = esc_attr($user->ID); $staff_nickname = esc_attr($user->user_login); $staff_email = esc_attr($user->user_email); $staff_phone = esc_attr($user->staff_phone); $staff_title = esc_attr($user->staff_title); $staff_program = esc_attr($user->staff_program); $staff_department = esc_attr($user->staff_department); $staff_role = esc_attr(array_shift($user->roles)); $staff_bio = esc_attr($user->user_description); //User biography if('' != pods_image($user->staff_picture, 'thumbnail')){ $staff_avatar = pods_image_url($user->staff_picture, array(400,400), $default, true);} else { $staff_avatar = '[URL TO DEFAULT AVATAR REMOVED]';}; $staff_department = esc_attr($user->staff_department); // Let's start displaying staff if($current_col == 0) { $v .= ''; } $v .= do_shortcode('<div class="column mcb-column ' . $col_class . '">[our_team image="' . $staff_avatar . '" title="' . $staff_name . '" subtitle="' . $staff_title . '" email="' . $staff_email . '" phone="' . $staff_phone . '" style="circle"]<p>' . $staff_bio . '</p>[/our_team]</div>'); if ($current_col == $colnums) { $current_col = 0; $v .='<div class="column mcb-column one column_divider"><hr class="no_line"></div>'; } else { $current_col += 1; } } return $v; } add_shortcode('TCOG_Program_Staff','display_tcog_program_staff');
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] User (extended) pod type – HTML// Displaying TCOG General Staff function display_tcog_general_staff($atts) { $args = array( 'role' => 'general_staff', 'meta_key' => 'last_name', 'orderby' => 'meta_value', 'order' => 'ASC', ); $users = get_users($args); $current_col = 0; $colnums = 3; // Number of Columns (we want four per row) $v = '<div class="mfn_heading heading_lines align_center"><h4 class="title" style="color:#3a80f1;"><span class="line line_l" style="background:#000;"></span>Program Staff<span class="line line_r" style="background:#000;"></span></h4></div>'; foreach ($users as $user) { // Let's make variables $staff_name = esc_attr($user->user_firstname) . ' ' . esc_attr($user->user_lastname); $staff_id = esc_attr($user->ID); $staff_nickname = esc_attr($user->user_login); $staff_email = esc_attr($user->user_email); $staff_phone = esc_attr($user->staff_phone); $staff_title = esc_attr($user->staff_title); $staff_program = esc_attr($user->staff_program); $staff_department = esc_attr($user->staff_department); $staff_role = esc_attr(array_shift($user->roles)); // $staff_bio = esc_attr($user->user_description); //User biography if('' != pods_image($user->staff_picture, 'thumbnail')){ $staff_avatar = pods_image_url($user->staff_picture, array(400,400), $default, true);} else { $staff_avatar = '[URL TO DEFAULT AVATAR REMOVED]';}; $staff_department = esc_attr($user->staff_department); // Let's start displaying staff if($current_col == 0) { $v .= '<div class="wrap mcb-wrap one valign-top clearfix">'; } $v .= do_shortcode('<div class="column mcb-column one-fourth">[our_team image="' . $staff_avatar . '" title="' . $staff_name . '" subtitle="' . $staff_title . '" email="' . $staff_email . '" phone="' . $staff_phone . '" style="circle"][/our_team]</div>'); if ($current_col == $colnums) { $current_col = 0; $v .='</div><div class="column mcb-column one column_divider "><hr class="no_line"></div>'; } else { $current_col += 1; } } $v .='</div>'; return $v; } add_shortcode('TCOG_General_Staff','display_tcog_general_staff');
Here’s the function for the shortcode.
- This reply was modified 3 years, 11 months ago by Sean.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] User (extended) pod type – HTMLThanks for the response, @keraweb
Allow me to clarify:
I use Pods to extend my Users so I can add additional fields for the purpose of displaying that data in a staff directory on the front end of my website through a custom shortcode I wrote. One of the Fields is called
staff_program
and is aRelationship
field related to aSimple (custom defined list)
. TheCustom Defined Options
contains the program/department names at my office. TheSelection Type
isMultiple Select
and the Format isCheckboxes
. If one of theCustom Defined Options
has the & character (not the HTML entity) and I check thatOption
when creating aNew User
or editing anExisting User
, it does not commit onSave
. However, that has not always been the case.For example:
I am adding a new
User
, Jack Black. Jack works inAdministration & Finance
so I check thatOption
in thestaff_program
field andSave
.I use a custom shortcode to output all users on the front-end of the website, filtered by the
staff_program
(see below):[TCOG_Program_Staff program="Administration & Finance" columns="1"]
This shortcode should list all Users with the
Administration & Finance
checkbox selected from thestaff_program
field in a single column. Up until recently, it worked as expected, so userJack Black
would have displayed.However, the Meta does not commit on save, and if I go back to edit user
Jack Black
it’s like I never checked the box. If I selected a different option that doesn’t contain the ampersand and then saved, it works.In troubleshooting, I changed the option from
Administration & Finance
toAdministration & amp; Finance
(without the space in the HTML entity for ampersand), saved those changes and the meta was retained. But on the front end of the website in the directory, Jack Black still isn’t displayed with other existing users in the directory who I had previously assigned to theAdministration & Finance
option.So I updated my custom shortcode to be:
[TCOG_Program_Staff program="Administration & amp; Finance" columns="1"]
and now ‘Jack Black’ appears in the directory on the front end but the others don’t. I’ve gone back in, re-added the
Administration & amp; Finance
option to the existing users and everyone appears as designed in the output on the front end.===
So I’m assuming there was an update to the plugin’s code at some point fairly recently which does not like non-HTML ampersands in the options of a Custom Defined List relationship field.
Happy to try to re-explain again, lol.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Relationship Lookup (Users)I’ve narrowed down the culprit of this issue.
So, I’ve used this relationship field to query the Users. I want to select the user’s name in order to access their email address. Although I’ve not changed this pod or its configuration since I created it in late 2017, in order for the names to start appearing again I had to remove {@email} from the Display Field in Selection List. I really need the email though.
I hope this makes sense.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Relationship Lookup (Users)I’m currently troubleshooting and created a new field – the autocomplete field now works with users.
Interesting: in the original field I have limited the list to specific roles (which includes custom user roles). The checkboxes usually are on/off, but now there are three states of the checkbox – on/on/off
I renamed the old field and gave the new field the name of the old field. Problem repeats itself.
Forum: Plugins
In reply to: [User Access Manager] Compatibility with User Role Editor?I have not had any conflicts when using both of these plugins together. I am experiencing other issues at the moment with UAM, but URE and UAM worked fine together.
Forum: Plugins
In reply to: [Document Gallery] Display documents attached to a different pageAwesome, thanks for your prompt and promising reply. While you’re at it, another feature that may be beneficial to folks is to have an exclude option when using the shortcode.
This should presumably be exclusive of the attribute for including specific IDs where you cannot use both in the same shortcode. So like [dg exclude=1,5] where 1 or 5 are the ids of the files which should be excluded from being displayed.Forum: Plugins
In reply to: [Document Gallery] Error After Update@dan, I too receive an error:
Warning: array_key_exists(): The first argument should be either a string or an integer in ********\wp-content\plugins\document-gallery\models\class-document.php on line 140
This error is present only when NOT logged in and, interestingly, appears before my main post content. The document gallery still appears where I’ve inserted the dg shortcode:
[dg orderby="menu_order"]
within the content of my post.I’m running WP 3.8 on a localhost install, Version 1.4.1 of Document Gallery plugin.
Also, if this has any relevance, the icon displayed for the document type .htm is DIFFERENT when logged in vs. logged out. I thought that is odd. The other filetypes I have displayed don’t change icons when logged in or out.
Logged in icon displayed for .htm file: /wp-content/plugins/document-gallery/icons/html.png
Logged out icon displayed for .htm file: /wp-includes/images/crystal/code.pngFinally, this error is printed five times, which is the number of documents in the gallery with the .htm filetype. I am not seeing this error on other pages or posts using the
[dg]
shortcode where there is not a .htm file in the gallery (though I haven’t tested out on other doc types).Forum: Plugins
In reply to: [Approval Workflow] [Plugin: Approval Workflow] No NotificationI’ll have to do some more research into why I’m not getting the notifications…
They don’t appear to be going to spam. I do receive notifications from some users but not all (even though they share the same role).
Here’s a screenshot of the user role I’ve modified.
https://i46.tinypic.com/fe2ves.pngForum: Plugins
In reply to: [Approval Workflow] [Plugin: Approval Workflow] No NotificationI updated to 1.3.1 and submitted another change by my test user but have not received the admin notification.
I do not get the array or modify header warnings though.
Additionally, all changes are still being published to the live page (whether the checkbox is selected or not.)My test user is allowed to edit pages & edit published pages but cannot publish new pages. If I remove either of these options my user cannot even access the pages admin menu.
Forum: Plugins
In reply to: [Approval Workflow] [Plugin: Approval Workflow] No NotificationI tested a submission and got the following error:
Warning: array_pop() [function.array-pop]: The argument should be an array in /home/[xxxxx]/public_html/wp-content/plugins/approval-workflow/approval-workflow.php on line 248
Warning: Cannot modify header information – headers already sent by (output started at /home/[xxxx]/public_html/wp-content/plugins/approval-workflow/approval-workflow.php:248) in /home/[xxxx]/public_html/wp-includes/pluggable.php on line 881