Hi,
We have created a custom attribute of type attachment and displayed the same in vendor block. But it is visible to only users who have logged in to the system. If we check without login or in an incognito mode, the attribute is not visible. Please let us know if it is restricted like this or we are missing something.
Thank you in advance.
Hi,
Could you please share your attribute settings? Also, have you tried testing with only HivePress plugins enabled to rule out possible conflicts? Could you please let us know which version of HivePress you’re currently using?
I’ve tried reproducing the issue locally but wasn’t able to do so: Attachment attribute | Loom. The attachment is visible on my end both for logged-in and logged-out users. If there are any specific steps I may be missing, please let me know.
Hi,
Thank you for your reply. Please find below the required details:
HivePress Version: 1.7.23
Attribute settings are shared as a screenshot.
Not able to add another screenshot but other settings are specifying the block area to display an attribute with icon and value.
As suggested, we tested the issue with only the HivePress plugins enabled and realised that the issue seems to be related to the custom code used for the modification.
We are trying to add a download icon in the vendor block footer area beside the message icon and provide the link of the attachment-type attribute through it. However, this is working only for logged-in users and not for guests.
Could you please confirm whether there are any restrictions related to the footer area or attachment links for non-logged-in users, especially since the messaging functionality is also available only after login?
On the other hand, we have added another custom icon in the same footer area linking to the View Profile page, and that icon works correctly for both logged-in and guest users.
Thank you.
Thanks for the details.
There are no restrictions in the code that could affect this behavior.
Could you please let us know if you’re using the Memberships plugin? If so, there is a possibility that the attribute is restricted at the plan level, which is why it may not be available.
Hi,
Thank you for your response. We are not using Membership plugin.
Thanks for the details.
Could you please share the rest of the attribute settings, especially the Display section?
You also mentioned custom code, could you please elaborate a bit more on that as well?
Hi,
Please find below the display settings of the attribute which of attachment format:
For better use of block space and enhanced UI, we have used following custom code:
JavaScript:
document.addEventListener(“DOMContentLoaded”, function () {
document.querySelectorAll(".hp-vendor").forEach(function(card) {
/* Find attachment link */
let attachmentLink = card.querySelector(
'.hp-vendor__attribute a[href$=".pdf"], \
.hp-vendor__attribute a[href$=".doc"], \
.hp-vendor__attribute a[href$=".docx"]'
);
if (!attachmentLink) return;
/* Find footer */
let footer = card.querySelector(".hp-vendor__footer");
if (!footer) return;
/* Create download button */
let btn = document.createElement("a");
btn.href = attachmentLink.href;
btn.target = "_blank";
btn.className = "hp-download-btn";
btn.innerHTML = "📥";
/* Add button to footer */
footer.appendChild(btn);
/* Hide original attachment row */
let originalAttribute = attachmentLink.closest(".hp-vendor__attribute");
if (originalAttribute) {
originalAttribute.style.display = "none";
}
});
});
Additional CSS:
/\* Footer layout \*/
.hp-vendor__footer {
display: flex;
align-items: center;
position: relative;
}
/* Download icon */
.hp-download-btn {
position: absolute;
left: 42px; /* beside message icon \*/
font-size: 18px;
text-decoration: none;
filter: grayscale(100%);
opacity: 0.7;
}
/\* Hover \*/
.hp-download-btn:hover {
opacity: 1;
}
Let us know if you need further information.
Thank you.
Hi,
Thanks for the details.
These snippets shouldn’t introduce any logic that would make attachments invisible for non-logged-in users. The issue therefore seems to be coming from somewhere else.
Since you mentioned that the issue is resolved when only HivePress is active and does not persist, it is unlikely to be related to HivePress core functionality, as we are also unable to reproduce it locally.
Please consider temporarily removing any customizations that could potentially interfere, as well as third-party plugins, in order to further isolate the cause of the issue.