Forum Replies Created
-
AuthorPosts
-
bshepMemberThanks – the reason I needed the array is that I’m using the Admin Columns plugin to show my site admins a column with multiple values, and Admin Columns’ “multiple values” setting only works with an array. As far as other use, I’m fine with the way it is.
bshepMemberGot it working, but not sure I fully understand it. Right now I have my front-end form redirect set to empty by using ”. This tacks on my session variable as below in my functions file:
add_filter( ‘wp_redirect’, ‘my_stick_new_post_id_in_redirect’, 10, 2 );
function my_stick_new_post_id_in_redirect ( $location, $status ) {
return( $location.$_SESSION[“myv_apply_returl”] );
}My only remaining issue is that this fires on every form submit – how could I get it to work only when I need it? Would I need to put an id on the submit button, or does that have anything to do with the above code?
bshepMemberStill having issues with this. When combining it with jquery to disable the submit button (to prevent duplicate sumbissions), the redirect doesn’t work.
If there was a way to dynamically populate the forms “Redirect: ” comment, that would solve the problem. Anyone know of a way to do this?
bshepMemberI was able to get this working by adding the following to the bottom of the form, where $returl is my referring url, but would still like to know if there’s a better way…
if (isset($_POST[‘submit’])) { ?>
<script type=”text/javascript”>
window.location.href = ‘<?php echo $returl ?>’;
</script>
<?php } ?>
bshepMemberThanks – I actually just figured this out by modifying some code I used with CMB2 previously. I added the following to the top of my PikList metafields file:
$args = array(
‘blog_id’ => $GLOBALS[‘blog_id’],
‘meta_key’ => ‘last_name’,
‘orderby’ => ‘meta_value’,
‘order’ => ‘ASC’,
‘fields’ => ‘all’,
);$entries = get_users( $args );
$user_options = array();
if ( $entries ) {
foreach ( $entries as $entry ) {
$name = get_user_meta($entry->ID,’last_name’,’single’) . ‘, ‘ . get_user_meta($entry->ID,’first_name’,’single’) . ‘ (‘ . $entry->user_login . ‘)’;
$user_options[ $entry->ID ] = $name;
}
}Then referenced it in the select list with:
,’choices’ => array(” => ‘- Select -‘) + $user_options
This gave me the format I needed.
bshepMemberFound this was related to another issue I was having because I didn’t have latest beta installed. My redirect in comment block is working now.
bshepMemberI thought I had the latest, but didn’t (I even saw the notice about frontend forms working in 9.9x). After installing the latest version, it’s working. Thanks!
-
AuthorPosts