`<a class=”show-login” href=”#”>Sign in</a>
Thats how the link looks alike…
-
This reply was modified 9 years, 2 months ago by
branstoker.
Hi, you would need to first replace the function which renders Account field, you can do that with following code
add_action("init", "my_init");
function my_init() {
adverts_form_add_field("adverts_field_account", array(
"renderer" => "my_adverts_field_account",
"callback_save" => "adverts_save_multi",
"callback_bind" => "adverts_bind_multi",
));
}
Next you will need to define my_adverts_field_account() function which basically will be customized copy of adverts_field_account() function.
function my_adverts_field_account( $field ) {
$fa = $field;
if(is_user_logged_in() ) {
$text = __('You are posting as <strong>%1$s</strong>. <br/>If you want to use a different account, please <a href="%2$s">logout</a>.', 'adverts');
printf( '<div>'.$text.'</div>', wp_get_current_user()->display_name, wp_logout_url() );
} else {
$text = __('Create an account for me so I can manage all my ads from one place (password will be emailed to you) or <a href="%s">Sign In</a>', 'adverts');
$text = sprintf( $text, wp_login_url( get_permalink() ) );
$fa["options"] = array(
array(
"value" => "1",
"text" => $text
)
);
adverts_field_checkbox($fa);
}
}
The whole code you can add in your theme functions.php file.
Hi Greg!
Thanks a lot for your fast response. I played around a bit with the code and i was able to manage it, except for removing the checkbox itself.
I soluted this in css! If there’s a more elegant way to do it inside the functions.php let me know….:)
Here’s my code:
input#_adverts_account_1{
display:none;
}
add_action(“init”, “my_init”);
function my_init() {
adverts_form_add_field(“adverts_field_account”, array(
“renderer” => “my_adverts_field_account”,
“callback_save” => “adverts_save_multi”,
“callback_bind” => “adverts_bind_multi”,
));
}
function my_adverts_field_account( $field ) {
$fa = $field;
if(is_user_logged_in() ) {
$text = __(‘Sie sind als %1$s angemeldet.’, ‘adverts’);
printf( ‘<div>’.$text.'</div>’, wp_get_current_user()->display_name );
} else {
$text = __(‘Anmelden!‘, ‘adverts’);
$text = sprintf( $text, wp_login_url( get_permalink() ) );
$fa[“options”] = array(
array(
“value” => “1”,
“text” => $text
)
);
adverts_field_checkbox($fa);
}
}