make attachment links configurable
This commit is contained in:
parent
e0b020d4cc
commit
efa64457e3
3 changed files with 79 additions and 6 deletions
|
@ -14,6 +14,8 @@ class Admin {
|
|||
\add_action( 'admin_menu', array( '\Activitypub\Admin', 'admin_menu' ) );
|
||||
\add_action( 'admin_init', array( '\Activitypub\Admin', 'register_settings' ) );
|
||||
\add_action( 'show_user_profile', array( '\Activitypub\Admin', 'add_fediverse_profile' ) );
|
||||
\add_action( 'personal_options_update', array( '\Activitypub\Admin', 'save_profile' ), 11 );
|
||||
\add_action( 'edit_user_profile_update', array( '\Activitypub\Admin', 'save_profile' ), 11 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +52,7 @@ class Admin {
|
|||
}
|
||||
|
||||
/**
|
||||
* Register PubSubHubbub settings
|
||||
* Register ActivityPub settings
|
||||
*/
|
||||
public static function register_settings() {
|
||||
\register_setting(
|
||||
|
@ -106,6 +108,14 @@ class Admin {
|
|||
'default' => array( 'post', 'pages' ),
|
||||
)
|
||||
);
|
||||
\register_setting(
|
||||
'activitypub', 'activitypub_profile_fields', array(
|
||||
'type' => 'array',
|
||||
'description' => \esc_html__( 'You can have up to 4 items displayed as a table on your profile.', 'activitypub' ),
|
||||
'show_in_rest' => true,
|
||||
'default' => array(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function add_settings_help_tab() {
|
||||
|
@ -132,10 +142,36 @@ class Admin {
|
|||
// todo
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param [type] $user
|
||||
* @return void
|
||||
*/
|
||||
public static function add_fediverse_profile( $user ) {
|
||||
?>
|
||||
<h2><?php \esc_html_e( 'Fediverse', 'activitypub' ); ?></h2>
|
||||
<?php
|
||||
\Activitypub\get_identifier_settings( $user->ID );
|
||||
\load_template( \dirname( __FILE__ ) . '/../templates/user-settings.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the ActivityPub specific data.
|
||||
*
|
||||
* @param int $user_id
|
||||
* @return void
|
||||
*/
|
||||
public static function save_profile( $user_id ) {
|
||||
if ( ! current_user_can( 'edit_user', $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$profile_fields = array();
|
||||
|
||||
if ( isset( $_POST['activitypub_profile_fields'] ) ) {
|
||||
foreach ( $_POST['activitypub_profile_fields'] as $key => $value ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
echo "<pre>";
|
||||
var_dump($_POST);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ msgstr ""
|
|||
"Project-Id-Version: ActivityPub 0.9.1\n"
|
||||
"Report-Msgid-Bugs-To: "
|
||||
"https://wordpress.org/support/plugin/wordpress-activitypub\n"
|
||||
"POT-Creation-Date: 2019-11-27 07:27:13+00:00\n"
|
||||
"POT-Creation-Date: 2019-11-27 08:14:18+00:00\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
|
37
templates/user-settings.php
Normal file
37
templates/user-settings.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<h2><?php \esc_html_e( 'Fediverse', 'activitypub' ); ?></h2>
|
||||
|
||||
<?php
|
||||
$user = wp_get_current_user();
|
||||
\Activitypub\get_identifier_settings( $user->ID );
|
||||
?>
|
||||
|
||||
<table class="form-table" role="presentation">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label><?php \esc_html_e( 'Profile fields', 'activitypub' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<p class="description"><?php \esc_attr_e( 'You can have up to 4 items displayed as a table on your profile.', 'activitypub' ); ?></p>
|
||||
<p>
|
||||
<label for="activitypub_profile_fields_0_name"><input id="activitypub_profile_fields_0_name" name="activitypub_profile_fields[0][name]" class="regular-text" type="text" placeholder="<?php \esc_attr_e( 'Label', 'activitypub' ); ?>" value="<?php ?>" /></label>
|
||||
<label for="activitypub_profile_fields_0_value"><input id="activitypub_profile_fields_0_value" name="activitypub_profile_fields[0][value]" class="regular-text" type="text" placeholder="<?php \esc_attr_e( 'Content', 'activitypub' ); ?>" /></label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub_profile_fields_1_name"><input id="activitypub_profile_fields_1_name" name="activitypub_profile_fields[1][name]" class="regular-text" type="text" placeholder="<?php \esc_attr_e( 'Label', 'activitypub' ); ?>" /></label>
|
||||
<label for="activitypub_profile_fields_1_value"><input id="activitypub_profile_fields_1_value" name="activitypub_profile_fields[1][value]" class="regular-text" type="text" placeholder="<?php \esc_attr_e( 'Content', 'activitypub' ); ?>" /></label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub_profile_fields_2_name"><input id="activitypub_profile_fields_2_name" name="activitypub_profile_fields[2][name]" class="regular-text" type="text" placeholder="<?php \esc_attr_e( 'Label', 'activitypub' ); ?>" /></label>
|
||||
<label for="activitypub_profile_fields_2_value"><input id="activitypub_profile_fields_2_value" name="activitypub_profile_fields[2][value]" class="regular-text" type="text" placeholder="<?php \esc_attr_e( 'Content', 'activitypub' ); ?>" /></label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub_profile_fields_3_name"><input id="activitypub_profile_fields_3_name" name="activitypub_profile_fields[3][name]" class="regular-text" type="text" placeholder="<?php \esc_attr_e( 'Label', 'activitypub' ); ?>" /></label>
|
||||
<label for="activitypub_profile_fields_3_value"><input id="activitypub_profile_fields_3_name" name="activitypub_profile_fields[3][value]" class="regular-text" type="text" placeholder="<?php \esc_attr_e( 'Content', 'activitypub' ); ?>" /></label>
|
||||
</p>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
Loading…
Reference in a new issue