Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Register the module
- cp_module_register( __( 'Points for Bp media', 'cp' ) , 'bp_media' , '1.0', '<a href="http://www.taraj.sk">Taraj.sk</a>', 'http://www.taraj.sk', 'http://taraj.sk/' , __( 'Points for add photos, videos or music', 'cp' ), 1 );
- // On installation, we set the default values for our custom points transactions.
- function cp_bp_media_install()
- {
- add_option( 'cp_bp_media_value1', 10 );
- }
- add_action( 'cp_module_bp_media_activate', 'cp_bp_media_install' );
- // If the module is active.
- if ( cp_module_activated( 'bp_media' ) )
- {
- // Add a function to display the form inputs.
- function cp_bp_media_config()
- {
- ?>
- <br />
- <h3><?php _e( 'Points for Bp media','cp' ); ?></h3>
- <table class="form-table">
- <tr valign="top">
- <th scope="row">
- <label for="cp_bp_media_value1"><?php _e( 'Points for add photos, videos or music', 'cp' ); ?>:</label>
- </th>
- <td valign="middle">
- <input type="text" id="cp_bp_media_value1" name="cp_bp_media_value1" value="<?php echo( get_option( 'cp_bp_media_value1' ) ); ?>" size="30" />
- </td>
- </tr>
- </table>
- <?php
- }
- add_action( 'cp_config_form','cp_bp_media_config' );
- // Create a function to process the form inputs when the form is submitted.
- function cp_bp_media_config_process()
- {
- // We update the options with the submitted values. We cast them as integers.
- update_option( 'cp_bp_media_value1', (int)$_POST['cp_bp_media_value1'] );
- }
- add_action( 'cp_config_process','cp_bp_media_config_process' );
- }
- add_action('bp_media_after_add_media','my_bp_media_add_cp');
- // Log
- add_action('cp_logs_description','cp_bp_media_log', 10, 4);
- function cp_bp_media_log($type,$uid,$points,$data){
- if($type!='cp_bp_media') { return; }
- _e('Add Media','cp_buddypress');
- }
- function my_bp_media_add_cp() {
- global $bp;
- $bpcpspamlist = explode(',' , get_option( 'bp_spammer_cp_bp' ) );
- foreach ( $bpcpspamlist as $spammer_id ) {
- if ($bp->loggedin_user->id == $spammer_id ) {
- $is_spammer = true;
- break;
- }
- else {
- $is_spammer = false;
- }
- }
- if ($is_spammer == false) {
- cp_points('cp_bp_media', $bp->loggedin_user->id, get_option('cp_bp_media_value1'), "");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement