Ad Title to include logged in user name
-
Hi Greg,
A while back you helped me default the ad-title depending on the ad category. I’ve been trying to modify this to include the logged-in user ID in the ad-title too by incorporating $current_user = wp_get_current_user(); $current_user->display_name but not having any success. The code snippet you gave me originally was:
add_filter( “adverts_form_bind”, “my_adverts_form_bind”, 1000 );
function my_adverts_form_bind( $form ) {
try {
if( $form->get_value( “post_title” ) ) {
return $form;
}
$titles = array(
“buyer” => “Buyer”,
“seller” => “Seller”,
);
$key = adverts_request( “preselected_category” );
if( $form->get_scheme( “name” ) == “advert” && isset( $titles[$key] ) ) {
$form->set_value( “post_title”, $titles[$key]);
}
} catch(Exception $e) {
// do nothing
}
return $form;
}Can you point me in the right direction?
Thanks,
Richard.
The page I need help with: [log in to see the link]
- The topic ‘Ad Title to include logged in user name’ is closed to new replies.