Forum Replies Created

Viewing 15 replies - 1 through 15 (of 37 total)
  • Hello Jan Dembowski,
    Your are right. My intention was not bad and thanks for understanding it.
    Actually i don’t know about this rule. And surely this will not happen again.
    Thanks Jan Dembowski.

    Hi iamdanieljs,

    You can create your own script to handle this task. Its very simple task though.

    You have to create custom database connection for fetching data from eventbooking_clients table
    Create one array namely users to get users data from eventbooking_clients table.
    Close this database connection after getting all the users in array.

    //For Example

    foreach($users as $user){
       $user_id = username_exists( $user['user_name'] );
       if ( !$user_id and email_exists($user['mail']) == false ) {
          $random_password = wp_generate_password( $length=12,
                             $include_standard_special_chars=false );
          $user_id = wp_create_user($user['user_name'], $random_password,  $user['email']);
      } else {
        $random_password = __('User already exists.  Password inherited.');
      }
    }

    If you want to do this task on regular basis(Example:execute a script on daily basis) than you can create one Cron job for it.
    Also you can manage this by inserting one new column like last_updated date in eventbooking_clients table and fetch only required users.

    rebeccahbl-

    You can do it in two ways.

    1. Keeping detail in option table. But before saving your detail you may encrypt it using any Encryption method .Create one algorithm(that will be found easily on google) that will help you to secure your login detail.

    For example
    To add into Option table.

    //Once you add this into database.You may remove this below line.
    add_option( 'username', 'Your encrypted username');

    To get from option table

    get_option( $option, $default );

    2. place your detail in config file.

    Glad to hear from you.

    Love this below sentence.

    I try to explain again, so other people who have this problem can learn from this ??

    Please mark this topic as Resolved

    Since you can do this with CSS as well.

    For example
    If you have below list

    <ul class="ul_class">
            <li><a title="" href=""></a></li>
            <li><a title="" href=""></a></li>
            <li><a title="" href=""></a></li>
            <li><a title="" href=""></a></li>
    </ul>

    So class can be added like this.

    .ul_class:last-of-type {
        //Set your style over here.
    }

    crovinca –

    I don’t understand your whole problem.
    Still i’d like to suggest as per my understanding.

    seems you should use in_array() function to make your condition as per your requirement.

    For exmaple:

    $count = array(2,5,8); /*It may change*/
    if (in_array($paged, $count)) {
       //Success.show your ads here
    }

    If the above is not pertinent, feel free to ignore it. And do let me know more about your problem.

    immoon-
    I think you should post only required code only.
    click on this link.

    It will surely resolve your problem.And still you need more help than let me know.

    anjanap-

    It’s very simple job.

    After successful creation of user you can apply below code.

    // Create post object
    $my_post = array(
      'post_title'    => 'Your Post title',
      'post_content'  => 'Your Post Content.',
      'post_status'   => 'publish',
      'post_author'   => 1, /* You may setup your created user id if he has
                               capabilities of doing so. */
      'post_category' => array(1) /* As per requirement */
    );
    
    $post_id = wp_insert_post( $my_post );

    By executing wp_insert_post,your post will be created.

    Now you have only one thing remaining – User’s Metadata.

    Here you may use add_post_meta or update_post_meta.

    add_post_meta($post_id, 'address', 'Ghatlodiya,Patidar Road, Ahmedabad');
    add_post_meta($post_id, 'country', 'INDIA');

    You can do this by updating option image_default_link_type

    Place this in your theme’s functions.php file.

    function change_imgage_default_link() {
            //You may change it media,file,post...
            update_option('image_default_link_type','none');
    }
    add_action('after_setup_theme', 'change_imgage_default_link');

    Hello matthewtvogel,

    I have done this tactic using jQuery in my one of the project.

    You can place below code in your plugin.

    <?php
    add_action('admin_head','hide_personal_options');
    function hide_personal_options() { ?>
        <script type="text/javascript">
        jQuery(document).ready(function($) {
        	$("#email").parent().parent().remove();  // Add id of email or whatever you want to hide
             $(".user-admin-color-wrap").hide(); //To disable Admin Color Scheme
        });
        </script>
    <?php }

    I have searched lot on google but nothing found helpful for the same till now.

    Let me know if this helps you.

    To display error message on the same page follow below tactic.

    add_action( 'before_delete_post', 'function_to_run_on_post_trash' );
    
    function function_to_run_on_post_trash( $post_id ){
        if(connection_not_found){ /* Or Anything similar */
    	wp_redirect( admin_url('edit.php?post_status=trash&post_type=post&my_unique_flag=error'));
    	exit;
        }
    }
    /*Handle GET parameter*/
    if(isset($_GET['my_unique_flag'])){ /*MUST be unique*/
    	if($_GET['my_unique_flag'] == 'error'){
    		echo '<div class="error">
    	             <p>Dear user, You are not allowed to do this...!! :)</p>
    	         </div>';
    	}
    }

    Put this below code in both the function

    if(connection_not_found){ /* Or Anything similar */
    	wp_redirect( admin_url('edit.php?post_status=trash&post_type=post&my_unique_flag=error'));
    	exit;
    }

    Also change wp_redirect url as per your edit,delete action.

    If above code does not work as per your requirement than do let me know.

    Have a good day… ??

    Below are the ways you can tell wordpress like “stop what you are doing”

    1. To control Trash action (on All Page/Published post page)

    add_action( 'wp_trash_post', 'function_to_run_on_post_trash' );
    
    function function_to_run_on_post_trash( $post_id ){
    
       //Check Your connection if found anything wrong then execute below code
       //f.e
       if(connection_not_found){
          echo '<div class="error">
                    <p>Sorry you can't delete blog rightnow</p>
                </div>';
          exit; /* MUST */
      }
    }

    2. To control Permanently Delete action (on Trash Page)

    add_action( 'before_delete_post', 'func_to_run_on_permanently_delete' );
    
    function func_to_run_on_permanently_delete( $post_id ){
    
       //Check Your connection
       //if found anything wrong then execute below code
       //f.e
       if(connection_not_found){ /* Or Anything similar */
          echo '<div class="error">
                    <p>Sorry you can't delete blog Permanently rightnow</p>
                </div>';
          exit; /* MUST */
      }
    }

    Make Your error message stylish and will work like charm.

    Please check trash_post

    Run actions on post, page, or custom post type is about to be trashed. The post ID is passed to the action hook.

    add_action( 'wp_trash_post', 'function_to_run_on_post_trash' );
    
    function function_to_run_on_post_trash( $post_id ){
    $one = 1;
    $two = 2;
    $result = $one + $two;
    }

    To add hook before inserting post to DB, you can use pre_post_update

    Forum: Hacks
    In reply to: post_not_in

    Hello ZaydB,

    There is no ‘post_not_in’ in get_posts function.

    I recommend WP_Query in place of get_posts.

Viewing 15 replies - 1 through 15 (of 37 total)