function rpx_admin_menu_view() { if (current_user_can(RPX_OPTIONS_ROLE) === false) { return false; } global $rpx_comment_actions; global $rpx_http_vars; if ($rpx_http_vars['rpx_cleanup'] == 'true') { rpx_clean_locked(); } $rpx_apikey = get_option(RPX_API_KEY_OPTION); if (strlen($rpx_apikey) != 40) { rpx_message('<strong>Enter valid API key.</strong><br />' . 'Get your apiKey ' . '<a target="new" href="https://login.janrain.com/openid/v2/signin?token_url=https%3A%2F%2Frpxnow.com%2Ffinish">here</a>' . ' if you have an Engage account.<br />' . 'View the account options ' . '<a target="new" href="http://www.janrain.com/products/engage/get-janrain-engage">here</a>' . ' to become a Janrain Engage customer.', 'html'); } $rpx_test = rpx_test_api(); $messages = array(); $messages['select'] = 'No supported HTTP option.'; $messages['post'] = 'Unable to send POST to Engage server.'; $messages['api'] = 'Unable to retrive data from Engage API.'; $messages['ssl_valid'] = 'This PHP does not support SSL certificate validation, certificate testing disabled.'; foreach ($messages as $key => $message) { if ($rpx_test[$key] === false) { rpx_message($message, 'error'); } } ?> <style type="text/css"> .rpx_tr_sub td { padding-left:40px; } .rpx_tr_lt { background-color:#EEE; } .rpx_tr_dk { background-color:#DDD; } .rpx_td_left { text-align:left; } .rpx_settings { width:612px; } .rpx_settings_block { width: 600px; background-color:#F6F6F6; border:0px; border-bottom:2px solid #EAF2FA; border-top:3px solid #EAF2FA; padding-left:6px; float:left; } .rpx_clear { clear:both; } </style> <script type="text/javascript"> function rpxshowhide(box,val) { if(document.getElementById(box).checked==true) { document.getElementById(val).style.visibility="inherit"; } else { document.getElementById(val).style.visibility="hidden"; } } </script> <div class="wrap"> <h2>Janrain Engage Setup</h2> <?php rpx_print_messages(); echo $rpx_test['select']; ?> <form method="post" action="options.php"> <div class="rpx_settings"> <div class="rpx_settings_block"> <?php settings_fields('rpx_settings_group'); ?> <label for="rpxapikey">Engage API Key: </label> <input id="rpxapikey" type="text" name="<?php echo RPX_API_KEY_OPTION; ?> " style="width:40em;" value="<?php echo get_option(RPX_API_KEY_OPTION); ?> " /> </div> <div class="rpx_settings_block"> <?php if (strlen(get_option(RPX_API_KEY_OPTION)) == 40) { ?> <h3>Sign-In Settings</h3> Setup Sign-In widget <a target="_blank" href="<?php echo get_option(RPX_ADMIN_URL_OPTION); echo RPX_SIGNIN_SETUP_URL; ?> ">here</a>.<br /> Add your site domain to the list <a target="_blank" href="<?php echo get_option(RPX_ADMIN_URL_OPTION); echo RPX_SETTINGS_SETUP_URL; ?> ">here</a>.<br /> <ul> <li> <label for="rpxsignin">Allow sign in via Engage: (This must be enabled for any Engage sign-in to work.)</label> <input id="rpxsignin" type="checkbox" name="<?php echo RPX_SIGNIN_OPTION; ?> " value="true"<?php if (get_option(RPX_SIGNIN_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </li><li> <label for="rpxwidget">Enable new Engage widget:</label> <input id="rpxwidget" type="checkbox" name="<?php echo RPX_NEW_WIDGET_OPTION; ?> " value="true"<?php if (get_option(RPX_NEW_WIDGET_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </li><li> <label for="rpxvemail">Allow sign in based on verifiedEmail match:</label> <input id="rpxvemail" type="checkbox" name="<?php echo RPX_VEMAIL_OPTION; ?> " value="true"<?php if (get_option(RPX_VEMAIL_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </li><li> <label for="rpxcomm">Login link for comments:</label> <select id="rpxcomm" name="<?php echo RPX_COMMENT_OPTION; ?> "> <option value="none"<?php if (get_option(RPX_COMMENT_OPTION) == 'none') { echo ' selected="selected"'; } ?> >None</option><?php foreach ($rpx_comment_actions as $key => $val) { ?> <option value="<?php echo $val; ?> "<?php if (get_option(RPX_COMMENT_OPTION) == $val) { echo ' selected="selected"'; } ?> ><?php echo $key; ?> </option><?php } ?> </select><br> <span>* Wordpress 3 themes.<br>¹ For "registered and logged in to comment"</span> </li> </ul> </div> <div class="rpx_settings_block"> <h3>Sign-In Registration</h3> Click <a href="?page=<?php echo RPX_MENU_SLUG; ?> &rpx_cleanup=true">here</a> to remove Engage incomplete (no email) accounts older than <?php echo RPX_CLEANUP_AGE; ?> minutes old. <?php $rpx_reg_mesg = ''; if (get_option('users_can_register') != 1) { $rpx_reg_mesg = '(You must enable the Wordpress General Setting for Membership "<a href="./options-general.php#users_can_register">Anyone can register</a>".)'; } ?> <ul> <li> <label for="rpxautoreg">Enable automatic user registration <?php echo $rpx_reg_mesg; ?> </label> <input id="rpxautoreg" type="checkbox" name="<?php echo RPX_AUTOREG_OPTION; ?> " value="true"<?php if (get_option(RPX_AUTOREG_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </li><li> <?php if (get_option(RPX_AUTOREG_OPTION) == 'true') { ?> <label for="rpxverifyname">Force users to select username:</label> <input id="rpxverifyname" type="checkbox" name="<?php echo RPX_VERIFYNAME_OPTION; ?> " value="true"<?php if (get_option(RPX_VERIFYNAME_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> <?php } else { ?> <?php } ?> </li><li> <label for="rpxwplogin">Show Engage sign in on wp-login page:</label> <input id="rpxwplogin" type="checkbox" name="<?php echo RPX_WPLOGIN_OPTION; ?> " value="true"<?php if (get_option(RPX_WPLOGIN_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </li> </ul> </div><?php $rpx_new_widget_option = get_option(RPX_NEW_WIDGET_OPTION); if ($rpx_new_widget_option == 'false') { ?> <div class="rpx_settings_block">Expert legacy widget options: <br> <label for="rpxparamstxt">Additional iframe URL parameters (use & to separate):</label> <input id="rpxparamstxt" name="<?php echo RPX_PARAMS_OPTION; ?> " type="text" size=50 value="<?php $rpx_params_txt = get_option(RPX_PARAMS_OPTION); if (empty($rpx_params_txt)) { $rpx_params_txt = RPX_PARAMS_OPTION_DEFAULT; } echo $rpx_params_txt; ?> " /> </div> <?php } ?> <div class="rpx_settings_block"> <h3>General User Experience</h3> <ul> <li> <label for="rpxavatar">Use social provider avatars on comments:</label> <input id="rpxavatar" type="checkbox" name="<?php echo RPX_AVATAR_OPTION; ?> " value="true"<?php if (get_option(RPX_AVATAR_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </li><li> <label for="rpxremovable">Allow users to remove their Engage provider and data:</label> <input id="rpxremovable" type="checkbox" name="<?php echo RPX_REMOVABLE_OPTION; ?> " value="true"<?php if (get_option(RPX_REMOVABLE_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </li> </ul> </div> <?php $rpx_social_pub = get_option(RPX_SOCIAL_PUB); if (!empty($rpx_social_pub)) { ?> <div class="rpx_settings_block"> <h3>Social Sharing Settings</h3> Setup Social Sharing widget <a target="_blank" href="<?php echo get_option(RPX_ADMIN_URL_OPTION); echo RPX_SOCIAL_SETUP_URL; ?> ">here</a>. <p> <label for="rpxsocial">Enable social sharing:</label> <input onclick="rpxshowhide('rpxsocial','rpxshareopts');" id="rpxsocial" type="checkbox" name="<?php echo RPX_SOCIAL_OPTION; ?> " value="true"<?php if (get_option(RPX_SOCIAL_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </p> <div id="rpxshareopts"> <p> <label for="rpxnewshare">Enable new share widget:</label> <input onclick="rpxshowhide('newshare','rpx_share_auth_option');" id="newshare" type="checkbox" name="<?php echo RPX_NEW_SHARE_OPTION; ?> " value="true"<?php if (get_option(RPX_NEW_SHARE_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </p> <div id="rpx_share_auth_option"> <p> <label for="rpxsocialauth">Sign in on share:</label> <input onclick="rpxshowhide('rpxsocialauth','rpx_share_reg');" id="rpxsocialauth" type="checkbox" name="<?php echo RPX_SHARE_AUTH_OPTION; ?> " value="true"<?php if (get_option(RPX_SHARE_AUTH_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </p> <p id="rpx_share_reg"> <label for="rpxsocialreg">Register on share: (Disables forced email collection.)</label> <input id="rpxsocialreg" type="checkbox" name="<?php echo RPX_SHARE_REG_OPTION; ?> " value="true"<?php if (get_option(RPX_SHARE_REG_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </p> </div> </td> <p> <label for="rpxsloc">Share link on articles:</label> <select id="rpxsloc" name="<?php echo RPX_S_LOC_OPTION; ?> "> <option value="none"<?php if (get_option(RPX_S_LOC_OPTION) == 'none') { echo ' selected="selected"'; } ?> >None</option> <option value="top"<?php if (get_option(RPX_S_LOC_OPTION) == 'top') { echo ' selected="selected"'; } ?> >at opening of article</option> <option value="bottom"<?php if (get_option(RPX_S_LOC_OPTION) == 'bottom') { echo ' selected="selected"'; } ?> >at closing of article</option> </select> </p> <p> <label for="rpxsoccom">Share link on comments:</label> <input id="rpxsoccom" type="checkbox" name="<?php echo RPX_SOCIAL_COMMENT_OPTION; ?> " value="true"<?php if (get_option(RPX_SOCIAL_COMMENT_OPTION) == 'true') { echo ' checked="checked"'; } ?> /> </p> <p> <label for="rpxshct">Show count bubbles:</label> <select id="rpxshct" name="<?php echo RPX_SHARE_COUNT_OPTION; ?> "> <option value="false"<?php if (get_option(RPX_SHARE_COUNT_OPTION) == 'false') { echo ' selected="selected"'; } ?> >none</option> <option value="hover"<?php if (get_option(RPX_SHARE_COUNT_OPTION) == 'hover') { echo ' selected="selected"'; } ?> >on mouse hover</option> <option value="always"<?php if (get_option(RPX_SHARE_COUNT_OPTION) == 'always') { echo ' selected="selected"'; } ?> >always on</option> </select> </p> <p> <label for="rpxsloc">Share link style:</label> <select id="rpxsloc" name="<?php echo RPX_S_STYLE_OPTION; ?> "> <option value="icon"<?php if (get_option(RPX_S_STYLE_OPTION) == 'icon') { echo ' selected="selected"'; } ?> >Icons</option> <option value="label"<?php if (get_option(RPX_S_STYLE_OPTION) == 'label') { echo ' selected="selected"'; } ?> >Text</option> </select> <br> <label for="rpxsharetxt">Share label/button text (use &nbsp; for none):</label> <input id="rpxsharetxt" name="<?php echo RPX_S_TXT_OPTION; ?> " type="text" size=30 value="<?php $rpx_s_txt = get_option(RPX_S_TXT_OPTION); if (empty($rpx_s_txt)) { $rpx_s_txt = RPX_S_TXT_OPTION_DEFAULT; } echo $rpx_s_txt; ?> " /> </p> </div> </div> <div class="rpx_settings_block"> Current provider icons:<br> <?php echo rpx_small_buttons(); ?> <br> If these do not match your selection on the Engage dashboard click save below to refresh. </div> </div> <script type="text/javascript"> rpxshowhide('rpxsocial','rpxshareopts'); rpxshowhide('newshare','rpx_share_auth_option'); rpxshowhide('rpxsocialauth','rpx_share_reg'); </script><?php } else { ?> <div class="rpx_settings_block"> Visit your <a href="<?php echo get_option(RPX_ADMIN_URL_OPTION); echo RPX_SOCIAL_SETUP_URL; ?> " target="_blank">Social Widget Setup</a> if you would like to enable social sharing.<br /> To update the plugin you must click Save after you are done. </div> <?php } } ?> <div class="rpx_clear"> </div> <div class="rpx_settings_block"> <p class="submit"> <input type="submit" class="button-primary" value="<?php _e('Save Changes'); ?> " /> </p> </div> </form> </div><?php }
function rpx_update_user_meta($wp_id, $meta_label, $value) { /*wrapper for Wordpress update to avoid returning false on updates that match current values*/ $result = rpx_get_user_meta($wp_id, $meta_label); if ($result == $value) { return true; } if (update_user_meta($wp_id, $meta_label, $value, $result) === false) { rpx_message('Meta update failed', 'error'); return false; } return true; }