Limit logged-in users to two entries per day

add_action(‘frm_display_form_action’, ‘check_entry_count’, 8, 3); function check_entry_count($params, $fields, $form){ remove_filter(‘frm_continue_to_new’, ‘__return_false’, 50); global $user_ID; if($form->id == 5 and !is_admin()){ //replace 5 with your form ID $count = FrmEntry::getRecordCount(“form_id=”. $form->id .” AND it.created_at > ‘”. gmdate(‘Y-m-d’).” 00:00:00′ AND user_id=”.$user_ID); //$count = FrmEntry::getRecordCount(“form_id=”.…Continue reading

Limit Logged in users to two entries per 24 hour period

add_action(‘frm_display_form_action’, ‘check_entry_count’, 8, 3); function check_entry_count($params, $fields, $form){ global $user_ID; remove_filter(‘frm_continue_to_new’, ‘__return_false’, 50); if($form->id == 5 and !current_user_can(‘administrator’)) { //change 5 to the form ID $one_day_ago = strtotime(current_time(‘mysql’, 1)) – (60*60*24); //calculate 24 hours ago $count = FrmEntry::getRecordCount(“it.created_at > ‘”.date(‘Y-m-d…Continue reading

Duplicate Posts and Pages (copy)

// Add the duplicate link to action list for post_row_actions // for “post” and custom post types add_filter( ‘post_row_actions’, ‘rd_duplicate_post_link’, 10, 2 ); // for “page” post type add_filter( ‘page_row_actions’, ‘rd_duplicate_post_link’, 10, 2 ); function rd_duplicate_post_link( $actions, $post ) {…Continue reading

Accordion Template Helper

/** * For the Accordion Template, this is a helper script * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ add_action( ‘wp_head’, function () { ?>Continue reading

管理バーにマニュアルや外部リンクを設置する

//管理バーメニューにマニュアル設置 function add_link_other_site( $wp_admin_bar ) { if (is_user_logged_in() ){ $wp_admin_bar->add_node(array( ‘id’ => ‘manuallink’, ‘title’ => ‘マニュアル’, ‘href’ => ‘#’ )); } } add_action(‘admin_bar_menu’, ‘add_link_other_site’, 100); function add_link_target_blank() { if (is_user_logged_in() ){ printContinue reading

管理画面のメニュー制御(サイド、管理バー)

// 管理サイドバーメニューの非表示 function remove_menus(){ $user = wp_get_current_user(); if( $user-> get(‘user_login’) !== “admin_99”) { remove_menu_page( ‘edit.php?post_type=cta’ ); // CTA管理 remove_menu_page( ‘edit.php?post_type=aftag’ ); // タグ管理 remove_menu_page( ‘edit.php?post_type=afranking’ ); // タグランキング remove_menu_page( ‘siteguard’ ); remove_menu_page( ‘snippets’ ); remove_menu_page( ‘pmxe-admin-export’ ); remove_menu_page( ‘pmxi-admin-import’ );…Continue reading