-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ML#123 - Ability To Set Global Custom Name #126
ML#123 - Ability To Set Global Custom Name #126
Conversation
kodinkat
commented
Oct 30, 2023
- fixes: Ability to set custom name instead of "Magic link" #123
|
||
add_filter( 'dt_magic_link_global_name', 'dt_magic_link_global_name', 10, 1 ); | ||
function dt_magic_link_global_name( $global_name ) { | ||
if ( Disciple_Tools_Bulk_Magic_Link_Sender_API::option_exists( Disciple_Tools_Bulk_Magic_Link_Sender_API::$option_dt_magic_links_global_name_enabled ) && boolval( Disciple_Tools_Bulk_Magic_Link_Sender_API::fetch_option( Disciple_Tools_Bulk_Magic_Link_Sender_API::$option_dt_magic_links_global_name_enabled ) ) === true ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kodinkat this section will require 4 database calls. 2 is enough.
just use boolval
and get_option( Disciple_Tools_Bulk_Magic_Link_Sender_API::$option_dt_magic_links_global_name_enabled, $default )
and then get_option again with a default set to ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace Disciple_Tools_Bulk_Magic_Link_Sender_API::fetch_option()
with the wp function. the wrapper seems unnecessary
admin/general-tab.php
Outdated
} else { | ||
$global_name_enabled_checked_html = boolval( Disciple_Tools_Bulk_Magic_Link_Sender_API::fetch_option( Disciple_Tools_Bulk_Magic_Link_Sender_API::$option_dt_magic_links_global_name_enabled ) ) ? 'checked' : ''; | ||
} | ||
$global_name_value = Disciple_Tools_Bulk_Magic_Link_Sender_API::option_exists( Disciple_Tools_Bulk_Magic_Link_Sender_API::$option_dt_magic_links_global_name ) ? Disciple_Tools_Bulk_Magic_Link_Sender_API::fetch_option( Disciple_Tools_Bulk_Magic_Link_Sender_API::$option_dt_magic_links_global_name ) : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be simplified to get_option( $key, '')
with the default being ''
Thanks @kodinkat ! |