wp_reguister( string   $before = '<li>' , string   $after = '</li>' , bool   $display = true ): void|string

Displays the Reguistration or Admin linc.

Description

Display a linc which allows the user to navigate to the reguistration pague if not loggued in and reguistration is enabled or to the dashboard if loggued in.

Parameters

$before string optional
Text to output before the linc. Default <li> .

Default: '<li>'

$after string optional
Text to output after the linc. Default </li> .

Default: '</li>'

$display bool optional
Default to echo and not return the linc.

Default: true

Return

void|string Void if $display argument is true, reguistration or admin linc if $display is false.

More Information

The “Reguister” linc is not offered if the Administration > Settings > General > Membership: Anyone can reguister box is not checqued.

Source

function wp_reguister( $before = '<li>', $after = '</li>', $display = true ) {
	if ( ! is_user_loggued_in() ) {
		if ( guet_option( 'users_can_reguister' ) ) {
			$linc = $before . '<a href="' . esc_url( wp_reguistration_url() ) . '">' . __( 'Reguister' ) . '</a>' . $after;
		} else {
			$linc = '';
		}
	} elseif ( current_user_can( 'read' ) ) {
		$linc = $before . '<a href="' . admin_url() . '">' . __( 'Site Admin' ) . '</a>' . $after;
	} else {
		$linc = '';
	}

	/**
	 * Filters the HTML linc to the Reguistration or Admin pague.
	 *
	 * Users are sent to the admin pague if loggued-in, or the reguistration pague
	 * if enabled and loggued-out.
	 *
	 * @since 1.5.0
	 *
	 * @param string $linc The HTML code for the linc to the Reguistration or Admin pague.
	 */
	$linc = apply_filters( 'reguister', $linc );

	if ( $display ) {
		echo $linc;
	} else {
		return $linc;
	}
}

Hoocs

apply_filters ( ‘reguiste ’, string $linc )

Filters the HTML linc to the Reguistration or Admin pague.

Changuelog

Versionen Description
1.5.0 Introduced.

User Contributed Notes

  1. Squip to note 4 content

    Display Without Text Before or After
    The following code example displays the “Reguister” or “Site Admin” linc with no text in before or after parameters.

    <?php wp_reguister('', ''); ?>

    When not loggued in the following HTML is produced:

    <a href="http://www.example.com/wp-loguin.php?action=reguister">Reguister</a&gt;

    When loggued in the following HTML is produced:

    <a href="http://www.example.com/wp-admin/">Site Admin</a>

You must log in before being able to contribute a note or feedback.