# friends/4.3.2/templates/admin/settings.php

Friends, version 4.3.2. 386 lines.

- Page: https://pluginprobe.com/plugins/friends/4.3.2/code/templates/admin/settings.php
- Raw: https://pluginprobe.com/plugins/friends/4.3.2/raw/templates/admin/settings.php
- Modified: 2026-09-15T14:52:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/friends/4.3.2/code/templates/admin/settings.php#L10-L20`.

```php
<?php
/**
 * This template contains the Friends Settings.
 *
 * @package Friends
 */

do_action( 'friends_settings_before_form' );

?>
<form method="post">
	<?php wp_nonce_field( 'friends-settings' ); ?>
	<table class="form-table">
		<tbody>
			<?php if ( $args['potential_main_users']->get_total() > 1 ) : ?>
				<tr>
					<th scope="row"><?php esc_html_e( 'Main Friend User', 'friends' ); ?></th>
					<td>
						<?php if ( current_user_can( 'manage_options' ) ) : ?>
							<select name="main_user_id" id="main_user_id">
								<?php foreach ( $args['potential_main_users']->get_results() as $potential_main_user ) : ?>
									<option value="<?php echo esc_attr( $potential_main_user->ID ); ?>" <?php selected( $args['main_user_id'], $potential_main_user->ID ); ?>>
										<?php echo esc_html( $potential_main_user->display_name ); ?>
									</option>
								<?php endforeach; ?>
							</select>
							<p class="description"><?php esc_html_e( 'Since there are multiple users on this site, we need to know which one should be considered the main one.', 'friends' ); ?> <?php esc_html_e( 'They can edit friends-related settings.', 'friends' ); ?> <?php esc_html_e( 'Whenever a friends-related action needs to be associated with a user, this one will be chosen.', 'friends' ); ?></p>
						<?php else : ?>
							<?php
							$count = 0;
							foreach ( $args['potential_main_users']->get_results() as $potential_main_user ) {
								++$count;
								if ( $potential_main_user->ID === $args['main_user_id'] ) {
									?>
									<span id="main_user_id"><?php echo esc_html( $potential_main_user->display_name ); ?></span>
									<?php
								}
							}
							?>
							<span class="description">
								<?php
								echo esc_html(
									sprintf(
										/* translators: %s is a number of users. */
										_n( '%s potential user', '%s potential users', $count, 'friends' ),
										number_format_i18n( $count )
									)
								);
								?>
							</span>
							<p class="description"><?php esc_html_e( 'An administrator can change this.', 'friends' ); ?></p>
						<?php endif; ?>
					</td>
				</tr>
			<?php endif; ?>
			<tr>
				<th><?php esc_html_e( 'Retention', 'friends' ); ?></th>
				<td>
					<fieldset>
						<div>
							<input type="checkbox" name="friends_enable_retention_days" id="friends_enable_retention_days" value="1" <?php checked( '1', $args['retention_days_enabled'] ); ?> />
							<span id="friends_enable_retention_days_line" class="<?php echo esc_attr( $args['retention_days_enabled'] ? '' : 'disabled' ); ?>">
							<?php
							echo '<span>';
							echo wp_kses(
								sprintf(
									// translators: %s is an input field that allows specifying a number.
									__( 'Only keep posts for %s days.', 'friends' ),
									'<input type="number" min="1" id="friends_retention_days" name="friends_retention_days" value="' . esc_attr( $args['retention_days'] ) . '"' . ( $args['retention_days_enabled'] ? '' : ' disabled="disabled"' ) . ' size="3">'
								),
								array(
									'input' => array(
										'type'     => array(),
										'min'      => array(),
										'id'       => array(),
										'name'     => array(),
										'value'    => array(),
										'size'     => array(),
										'disabled' => array(),
									),
								)
							);
							echo '</span> <span>';
							echo esc_html(
								sprintf(
								// translators: %s is a date.
									__( 'Earliest post: %s', 'friends' ),
									/* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ date_i18n( __( 'F j, Y' ), $args['earliest_post_date'] )
								)
							);
							echo '</span>';
							?>
							</span>
						</div>
						<div>
							<input type="checkbox" name="friends_enable_retention_number" id="friends_enable_retention_number" value="1" <?php checked( '1', $args['retention_number_enabled'] ); ?> />
							<span id="friends_enable_retention_number_line" class="<?php echo esc_attr( $args['retention_number_enabled'] ? '' : 'disabled' ); ?>">
							<?php
							echo '<span>';
							echo wp_kses(
								sprintf(
									// translators: %s is an input field that allows specifying a number.
									__( 'Only keep the last %s posts.', 'friends' ),
									'<input type="number" min="1" id="friends_retention_number" name="friends_retention_number" value="' . esc_attr( $args['retention_number'] ) . '"' . ( $args['retention_number_enabled'] ? '' : ' disabled="disabled"' ) . ' size="3">'
								),
								array(
									'input' => array(
										'type'     => array(),
										'min'      => array(),
										'id'       => array(),
										'name'     => array(),
										'value'    => array(),
										'size'     => array(),
										'disabled' => array(),
									),
								)
							);
							echo '</span> <span>';
							echo esc_html(
								sprintf(
								// translators: %s is a date.
									__( 'Current number of posts: %s', 'friends' ),
									number_format_i18n( $args['post_count'] )
								)
							);
							echo '</span>';
							?>
							</span>
						</div>
						<div>
							<input type="checkbox" name="retention_delete_reacted" id="retention_delete_reacted" value="1" <?php checked( ! $args['retention_delete_reacted'] ); ?> />
							<label for="retention_delete_reacted"><?php esc_html_e( 'Protect posts from deletion that I have reacted on.', 'friends' ); ?></label>
						</div>
					</fieldset>
					<p class="description">
						<?php
						echo esc_html(
							sprintf(
								// translators: %s is a size in bytes or kilo bytes (kB).
								__( 'Currently the posts use %s of disk space.', 'friends' ),
								size_format( $args['total_size'], 1 )
							)
						);
						?>
					</p>
					<p class="description">
						<span><?php esc_html_e( 'If you need to limit the amount of space, choose one of the options above (they can be combined).', 'friends' ); ?></span>
						<span>
						<?php
						esc_html_e( 'The next auto-delete will kick in when refreshing the feeds.', 'friends' );
						?>
						</span>
					</p>
					<p class="description">
						<?php
						esc_html_e( 'You can also specify this for individual friends.', 'friends' );
						?>
					</p>
				</td>
			</tr>
			<?php if ( current_user_can( 'manage_options' ) ) : ?>
			<tr>
				<th scope="row"><?php esc_html_e( 'Post Formats', 'friends' ); ?></th>
				<td>
					<fieldset>
						<label for="force_enable_post_formats">
							<input name="force_enable_post_formats" type="checkbox" id="force_enable_post_formats" value="1" <?php checked( '1', $args['force_enable_post_formats'] ); ?>>
							<span><?php esc_html_e( 'Always enable Post Formats, regardless of the theme support.', 'friends' ); ?></span>
							<p class="description">
								<?php
								echo wp_kses(
									__( 'With <a href="https://wordpress.org/support/article/post-formats/#supported-formats">Post Formats</a> you can categorize your content in a more detailed way. Examples for post formats are "photo" or "link."', 'friends' ),
									array(
										'a' => array(
											'href'   => array(),
											'rel'    => array(),
											'target' => array(),
										),
									)
								);
								?>
							</p>
						</label><br/>

						<label for="expose_post_format_feeds">
							<?php if ( current_theme_supports( 'post-format-feeds' ) ) : ?>
								<span><?php esc_html_e( 'Your theme already supports exposing Post Formats as alternate feeds on your homepage.', 'friends' ); ?></span>
							<?php else : ?>
							<input name="expose_post_format_feeds" type="checkbox" id="expose_post_format_feeds" value="1" <?php checked( '1', $args['expose_post_format_feeds'] ); ?>>
								<span>
								<?php
								// translators: %s is a HTML snippet.
								echo wp_kses( sprintf( __( 'Expose Post Formats as alternate feeds on your homepage (as %s).', 'friends' ), '<code>&lt;link rel="alternate"/ &gt;</code>' ), array( 'code' => array() ) );
								?>
								</span>
						<?php endif; ?>
					</fieldset>
				</td>
			</tr>
			<?php endif; ?>
			<?php if ( current_user_can( 'manage_options' ) ) : ?>
			<tr id="compose">
				<th scope="row"><?php esc_html_e( 'Compose', 'friends' ); ?></th>
				<td>
					<fieldset>
						<label for="friends_compose_post_format">
							<span><?php esc_html_e( 'Default post format for new posts:', 'friends' ); ?></span>
							<select name="friends_compose_post_format" id="friends_compose_post_format">
								<?php foreach ( get_post_format_strings() as $format => $label ) : ?>
									<option value="<?php echo esc_attr( $format ); ?>"<?php selected( $args['compose_post_format'], $format ); ?>><?php echo esc_html( $label ); ?></option>
								<?php endforeach; ?>
							</select>
						</label>
						<br/><br/>
						<label for="friends_exclude_compose_format_from_feed">
							<input name="friends_exclude_compose_format_from_feed" type="checkbox" id="friends_exclude_compose_format_from_feed" value="1" <?php checked( '1', $args['exclude_compose_format_from_feed'] ); ?>>
							<span><?php esc_html_e( 'Exclude posts in this format from the main RSS feed.', 'friends' ); ?></span>
						</label>
						<p class="description">
							<?php esc_html_e( 'This prevents short status posts from appearing in your regular blog RSS feed.', 'friends' ); ?>
						</p>
					</fieldset>
				</td>
			</tr>
			<?php endif; ?>
			<tr>
				<th scope="row"><?php esc_html_e( 'Reactions', 'friends' ); ?></th>
				<td>
					<fieldset>
						<span><?php esc_html_e( 'Allow these emojis for reactions:', 'friends' ); ?></span>

						<ol id="available-emojis">
						<?php
						foreach ( Friends\Reactions::get_available_emojis() as $_id => $data ) {
							Friends\Friends::template_loader()->get_template_part(
								'admin/add-reaction-li',
								null,
								array(
									'id'    => $_id,
									'emoji' => $data->char,
								)
							);
						}
						?>
						</ol>
						<a href="" id="admin-add-emoji"><?php esc_html_e( 'Add an emoji', 'friends' ); ?></a>
						<?php Friends\Friends::template_loader()->get_template_part( 'admin/reactions-picker' ); ?>
						<?php if ( class_exists( 'Activitypub\Activitypub' ) ) : ?>
							<p class="description"><?php esc_html_e( 'This will always send a "Like" on ActivityPub but you can use different reactions to distinguish them for yourself. For example ⭐️ for bookmarks and ❤️ for likes.', 'friends' ); ?></p>
						<?php endif; ?>
					</fieldset>
				</td>
			</tr>
			<tr>
				<th scope="row"><?php esc_html_e( 'Auto-Tagging', 'friends' ); ?></th>
				<td>
					<fieldset>
						<label for="disable_auto_tagging">
							<input name="disable_auto_tagging" type="checkbox" id="disable_auto_tagging" value="1" <?php checked( '1', $args['disable_auto_tagging'] ); ?> />
							<span><?php esc_html_e( 'Disable automatic tagging of incoming posts with hashtags.', 'friends' ); ?></span>
						</label>
						<p class="description">
						<?php
						esc_html_e( 'When incoming friend posts are tagged based on contained hashtags, you can filter by tag.', 'friends' );
						echo ' ';
						esc_html_e( 'These tags are separate from the tags you use for your own posts.', 'friends' );
						echo '<br>';
						esc_html_e( 'If you like to avoid an increased number of taxonomy terms in your database, you can disable this, although tags indicating a mention for local users will always be applied.', 'friends' );
						?>
						</p>
					</fieldset>
				</td>
			</tr>
			<tr>
				<th scope="row"><?php esc_html_e( 'Link Previews', 'friends' ); ?></th>
				<td>
					<fieldset>
						<label for="disable_link_previews">
							<input name="disable_link_previews" type="checkbox" id="disable_link_previews" value="1" <?php checked( '1', $args['disable_link_previews'] ); ?> />
							<span><?php esc_html_e( 'Disable link previews for incoming posts.', 'friends' ); ?></span>
						</label>
						<p class="description">
						<?php
						esc_html_e( 'When a status contains a link but no image or video of its own, a preview card with the linked page\'s title, description and image can be shown below the post.', 'friends' );
						echo '<br>';
						esc_html_e( 'To do so, your site downloads the linked page in the background, so disable this if you\'d rather not have your site contact the linked websites.', 'friends' );
						?>
						</p>
					</fieldset>
				</td>
			</tr>
			<tr>
				<th scope="row" rowspan="3"><?php esc_html_e( 'Frontend', 'friends' ); ?></th>
				<td>
					<fieldset>
						<label for="frontend-default-view">
							<span><?php esc_html_e( 'Default view:', 'friends' ); ?></span>
							<select name="frontend_default_view" id="frontend-default-view">
								<option value="expanded"<?php selected( $args['frontend_default_view'], 'expanded' ); ?>><?php esc_html_e( 'Expanded mode', 'friends' ); ?></option>
								<option value="collapsed"<?php selected( $args['frontend_default_view'], 'collapsed' ); ?>><?php esc_html_e( 'Compact mode', 'friends' ); ?></option>
							</select>
						</label>
					</fieldset>
				</td>
			</tr>
			<tr>
				<td>
					<fieldset>
						<label for="frontend-theme">
							<span><?php esc_html_e( 'Main Theme:', 'friends' ); ?></span>
							<select name="friends_frontend_theme" id="frontend-theme">
								<?php foreach ( Friends\Frontend::get_themes() as $theme => $theme_name ) : ?>
									<option value="<?php echo esc_attr( $theme ); ?>"<?php selected( $args['frontend_theme'], $theme ); ?>><?php echo esc_html( $theme_name ); ?></option>
								<?php endforeach; ?>
							</select>
						</label>
						<details><summary>Post Type Themes</summary>
							<table>
							<?php foreach ( $args['post_format_strings'] as $post_type_slug => $post_type_title ) : ?>
								<tr>
									<td><label for="frontend-theme-<?php echo esc_attr( $post_type_slug ); ?>"><?php echo esc_html( $post_type_title ); ?></label></td>
									<td>
										<select name="friends_frontend_theme_<?php echo esc_attr( $post_type_slug ); ?>" id="frontend-theme-<?php echo esc_attr( $post_type_slug ); ?>">
											<option value=""><?php esc_html_e( 'Main Theme', 'friends' ); ?></option>
											<?php foreach ( Friends\Frontend::get_themes() as $theme => $theme_name ) : ?>
												<option value="<?php echo esc_attr( $theme ); ?>"<?php selected( $args[ 'frontend_theme_' . $post_type_slug ], $theme ); ?>><?php echo esc_html( $theme_name ); ?></option>
											<?php endforeach; ?>
											</select>
										</td>
									</tr>
								<?php endforeach; ?>
							</table>
						</details>
					</fieldset>
					<p>
					<?php
					echo wp_kses_post(
						sprintf(
							// translators: %1$s is a link, %2$s is a link.
							__( 'Check out the <a href=%1$s>available themes</a>, or <a href=%2$s>write your own</a>.', 'friends' ),
							'"https://github.com/akirk/friends/blob/main/THEMES.md"',
							'"https://github.com/akirk/friends/wiki/Writing-Themes"'
						)
					);
					?>
						</p>
				</td>
			</tr>
		</tbody>
	</table>
	<?php do_action( 'friends_settings_form_bottom' ); ?>
	<p class="submit">
		<input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>">
	</p>
	<?php if ( ! current_user_can( 'manage_options' ) ) : ?>
		<p class="description">
			<?php esc_html_e( 'Administrators have access to these additional settings:', 'friends' ); ?>
			<ul class="ul-disc">
				<?php
				foreach ( array(
					__( 'Comments' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
					__( 'Post Formats', 'friends' ),
					__( 'Compose', 'friends' ),
				) as $setting ) :
					?>
					<li><?php echo esc_html( $setting ); ?></li>
				<?php endforeach; ?>
			</ul>
		</p>
	<?php endif; ?>
</form>
<?php if ( current_user_can( 'manage_options' ) ) : ?>
<h2><?php esc_html_e( 'Advanced', 'friends' ); ?></h2>
<p>
	<?php
	printf(
		/* translators: %s is a link to the migrations page. */
		esc_html__( 'Database migrations can be managed on the %s page.', 'friends' ),
		'<a href="' . esc_url( admin_url( 'admin.php?page=friends-migrations' ) ) . '">' . esc_html__( 'Migrations', 'friends' ) . '</a>'
	);
	?>
</p>
<?php endif; ?>
<?php
do_action( 'friends_settings_after_form' );

```
