add consistent attribution for imported stories

This commit is contained in:
Evan Mullins 2023-02-01 13:41:26 -05:00
parent 7d7bd801a3
commit 25f284998e
4 changed files with 101 additions and 1 deletions

View file

@ -0,0 +1,67 @@
{
"key": "group_63da9e534eecf",
"title": "User Meta",
"fields": [
{
"key": "field_63da9e5335575",
"label": "Import Source",
"name": "import_source",
"aria-label": "",
"type": "url",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": ""
},
{
"key": "field_63daa899548b3",
"label": "Import text",
"name": "import_text",
"aria-label": "",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"placeholder": "",
"prepend": "",
"append": ""
}
],
"location": [
[
{
"param": "user_form",
"operator": "==",
"value": "edit"
},
{
"param": "current_user_role",
"operator": "==",
"value": "administrator"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1675274791
}

View file

@ -5,7 +5,7 @@
Author: Evan Mullins
Author URI: https://circlecube.com
Template: twentynineteen
Version: 1.12.5
Version: 1.12.6
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wasmo
@ -1262,4 +1262,17 @@ div.lwa-modal-overlay div.lwa-modal-popup {
.entry .entry-content > .wp-block-group.alignwide > .wp-block-group__inner-container > * {
max-width: 100% !important;
}
.entry .entry-content .user-attribution {
align-items: center;
border: 1px solid var(--color-orange);
display: flex;
font-size: small;
gap: 1rem;
padding: 0 1rem;
}
.entry .entry-content .user-attribution p {
font-size: 16px;
margin: 0 .5em;
}

View file

@ -0,0 +1,19 @@
<?php
/**
* Section to display consistent attribution for imported profiles.
* @var $userid, $curauth
*/
?>
<?php
$import_source = get_field( 'import_source', 'user_' . $userid );
$import_text = get_field( 'import_text', 'user_' . $userid );
$default_text = 'Story originally posted at';
if ( $import_source || $import_text ) {
$import_text = $import_text ? $import_text : $default_text;
?>
<div class="user-attribution">
<h4>Attribution</h4>
<p><?php echo $import_text; ?> <?php echo auto_link_text( $import_source ); ?></p>
</div>
<?php } ?>

View file

@ -174,6 +174,7 @@ if (
<?php set_query_var( 'link', get_author_posts_url( $userid ) ); ?>
<?php get_template_part( 'template-parts/content/content', 'user-spotlight' ); ?>
<?php get_template_part( 'template-parts/content/content', 'user-posts' ); ?>
<?php get_template_part( 'template-parts/content/content', 'user-attribution' ); ?>
<?php get_template_part( 'template-parts/content/content', 'socialshares' ); ?>
<div class="is-layout-flex wp-block-buttons">